@@ -804,9 +804,6 @@ func SetWorkerContainerSpec(
804804	}, v1.EnvVar {
805805		Name :  constants .ContainerNameEnv ,
806806		Value : constants .TFContainerNameWorker ,
807- 	}, v1.EnvVar {
808- 		Name :  constants .LdPreloadEnv ,
809- 		Value : constants .LdPreloadLimiter ,
810807	}, v1.EnvVar {
811808		Name : constants .PodNamespaceEnv ,
812809		ValueFrom : & v1.EnvVarSource {
@@ -816,15 +813,28 @@ func SetWorkerContainerSpec(
816813		},
817814	})
818815
816+ 	if  ! strings .Contains (disabledFeatures , constants .BuiltInFeaturesGpuLimiter ) && 
817+ 		workloadProfile .ComputeIsolation  !=  constants .ComputingIsolationModeHard  {
818+ 		container .Env  =  append (container .Env , v1.EnvVar {
819+ 			Name :  constants .LdPreloadEnv ,
820+ 			Value : constants .LdPreloadLimiter ,
821+ 		})
822+ 	}
823+ 
819824	if  disabledFeatures  !=  ""  {
820825		container .Env  =  convertDisabledFeaturesToEnvs (disabledFeatures , container .Env )
821826	}
822827
823828	// TODO should calculate and set by hypervisor before container created 
829+ 	// when compute isolation mode is hard-isolation, memory limit also change to hard-mode 
830+ 	// open source vgpu.rs memory limiter is feedback-loop based, potentially cause resource contention 
824831	if  workloadProfile .ComputeIsolation  ==  constants .ComputingIsolationModeHard  {
825832		container .Env  =  append (container .Env , v1.EnvVar {
826833			Name :  constants .HardSMLimiterEnv ,
827834			Value : workloadProfile .Resources .Limits .ComputePercent .String (),
835+ 		}, v1.EnvVar {
836+ 			Name :  constants .HardMemLimiterEnv ,
837+ 			Value : strconv .FormatInt (workloadProfile .Resources .Limits .Vram .Value ()/ (1024 * 1024 ), 10 ),
828838		})
829839	}
830840
0 commit comments