6565from dstack ._internal .server .services .plugins import apply_plugin_policies
6666from dstack ._internal .server .services .probes import is_probe_ready
6767from dstack ._internal .server .services .projects import list_user_project_models
68- from dstack ._internal .server .services .resources import set_resources_defaults
68+ from dstack ._internal .server .services .resources import (
69+ set_gpu_vendor_default ,
70+ set_resources_defaults ,
71+ )
6972from dstack ._internal .server .services .runs .plan import get_job_plans
7073from dstack ._internal .server .services .runs .spec import (
7174 can_update_run_spec ,
@@ -343,8 +346,8 @@ async def get_plan(
343346 )
344347 if current_resource is not None :
345348 # For backward compatibility (current_resource may has been submitted before
346- # some fields, e.g., CPUSpec.arch, were added)
347- set_resources_defaults (current_resource .run_spec . configuration . resources )
349+ # some fields, e.g., CPUSpec.arch, gpu.vendor were added)
350+ _set_run_resources_defaults (current_resource .run_spec )
348351 if not current_resource .status .is_finished () and can_update_run_spec (
349352 current_resource .run_spec , effective_run_spec
350353 ):
@@ -354,7 +357,7 @@ async def get_plan(
354357 session = session ,
355358 project = project ,
356359 profile = profile ,
357- run_spec = run_spec ,
360+ run_spec = effective_run_spec ,
358361 max_offers = max_offers ,
359362 )
360363 run_plan = RunPlan (
@@ -410,8 +413,8 @@ async def apply_plan(
410413 current_resource = run_model_to_run (current_resource_model , return_in_api = True )
411414
412415 # For backward compatibility (current_resource may has been submitted before
413- # some fields, e.g., CPUSpec.arch, were added)
414- set_resources_defaults (current_resource .run_spec . configuration . resources )
416+ # some fields, e.g., CPUSpec.arch, gpu.vendor were added)
417+ _set_run_resources_defaults (current_resource .run_spec )
415418 try :
416419 spec_diff = check_can_update_run_spec (current_resource .run_spec , run_spec )
417420 except ServerClientError :
@@ -421,7 +424,7 @@ async def apply_plan(
421424 raise
422425 if not force :
423426 if plan .current_resource is not None :
424- set_resources_defaults (plan .current_resource .run_spec . configuration . resources )
427+ _set_run_resources_defaults (plan .current_resource .run_spec )
425428 if (
426429 plan .current_resource is None
427430 or plan .current_resource .id != current_resource .id
@@ -782,6 +785,16 @@ def run_model_to_run(
782785 return run
783786
784787
788+ def _set_run_resources_defaults (run_spec : RunSpec ) -> None :
789+ """Apply resource defaults to a run spec, including GPU vendor inference."""
790+ set_resources_defaults (run_spec .configuration .resources )
791+ set_gpu_vendor_default (
792+ run_spec .configuration .resources ,
793+ image = run_spec .configuration .image ,
794+ docker = getattr (run_spec .configuration , "docker" , None ),
795+ )
796+
797+
785798def _get_run_jobs_with_submissions (
786799 run_model : RunModel ,
787800 job_submissions_limit : Optional [int ],
0 commit comments