From 94f16280f9120e9f441f621df5e63f20a399e711 Mon Sep 17 00:00:00 2001 From: peterschmidt85 Date: Fri, 10 Oct 2025 21:04:34 +0200 Subject: [PATCH 1/2] [GCP] Support G4 preview instance type #3155 --- src/dstack/_internal/core/backends/base/offers.py | 1 + src/dstack/_internal/core/backends/gcp/compute.py | 8 +++++++- src/dstack/_internal/core/backends/gcp/models.py | 7 +++++++ src/dstack/_internal/core/backends/gcp/resources.py | 2 ++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/dstack/_internal/core/backends/base/offers.py b/src/dstack/_internal/core/backends/base/offers.py index c081b4271..16ed0aae2 100644 --- a/src/dstack/_internal/core/backends/base/offers.py +++ b/src/dstack/_internal/core/backends/base/offers.py @@ -23,6 +23,7 @@ "oci-spot", "lambda-arm", "gcp-a4", + "gcp-g4-preview", ] diff --git a/src/dstack/_internal/core/backends/gcp/compute.py b/src/dstack/_internal/core/backends/gcp/compute.py index 3d2af719b..66fb09bd4 100644 --- a/src/dstack/_internal/core/backends/gcp/compute.py +++ b/src/dstack/_internal/core/backends/gcp/compute.py @@ -130,13 +130,19 @@ def get_all_offers_with_availability(self) -> List[InstanceOfferWithAvailability offer_keys_to_offers = {} offers_with_availability = [] for offer in offers: + preview = False + if offer.instance.name.startswith("g4-standard-"): + if self.config.preview_features and "g4" in self.config.preview_features: + preview = True + else: + continue region = offer.region[:-2] # strip zone key = (_unique_instance_name(offer.instance), region) if key in offer_keys_to_offers: offer_keys_to_offers[key].availability_zones.append(offer.region) continue availability = InstanceAvailability.NO_QUOTA - if _has_gpu_quota(quotas[region], offer.instance.resources): + if preview or _has_gpu_quota(quotas[region], offer.instance.resources): availability = InstanceAvailability.UNKNOWN # todo quotas: cpu, memory, global gpu, tpu offer_with_availability = InstanceOfferWithAvailability( diff --git a/src/dstack/_internal/core/backends/gcp/models.py b/src/dstack/_internal/core/backends/gcp/models.py index 00c9492be..59a88d345 100644 --- a/src/dstack/_internal/core/backends/gcp/models.py +++ b/src/dstack/_internal/core/backends/gcp/models.py @@ -89,6 +89,13 @@ class GCPBackendConfig(CoreModel): description="The tags (labels) that will be assigned to resources created by `dstack`" ), ] = None + preview_features: Annotated[ + Optional[List[Literal["g4"]]], + Field( + description=("The list of preview GCP features to enable."), + max_items=1, + ), + ] = None class GCPBackendConfigWithCreds(GCPBackendConfig): diff --git a/src/dstack/_internal/core/backends/gcp/resources.py b/src/dstack/_internal/core/backends/gcp/resources.py index 57f2f8548..a28343cb3 100644 --- a/src/dstack/_internal/core/backends/gcp/resources.py +++ b/src/dstack/_internal/core/backends/gcp/resources.py @@ -26,6 +26,7 @@ {"accelerator_name": "nvidia-tesla-t4", "gpu_name": "T4", "memory_mb": 1024 * 16}, {"accelerator_name": "nvidia-tesla-v100", "gpu_name": "V100", "memory_mb": 1024 * 16}, {"accelerator_name": "nvidia-tesla-p100", "gpu_name": "P100", "memory_mb": 1024 * 16}, + {"accelerator_name": "nvidia-rtx-pro-6000", "gpu_name": "RTXPRO6000", "memory_mb": 1024 * 96}, ] @@ -499,5 +500,6 @@ def instance_type_supports_persistent_disk(instance_type_name: str) -> bool: "h3-", "v6e", "a4-", + "g4-", ] ) From f289aa934ebdf37a8d6fd48efaecc1a08d9af880 Mon Sep 17 00:00:00 2001 From: peterschmidt85 Date: Tue, 14 Oct 2025 08:09:48 -0700 Subject: [PATCH 2/2] [GCP] Support G4 preview instance type #3155 Review --- src/dstack/_internal/core/backends/gcp/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dstack/_internal/core/backends/gcp/models.py b/src/dstack/_internal/core/backends/gcp/models.py index 59a88d345..647b49d48 100644 --- a/src/dstack/_internal/core/backends/gcp/models.py +++ b/src/dstack/_internal/core/backends/gcp/models.py @@ -92,7 +92,7 @@ class GCPBackendConfig(CoreModel): preview_features: Annotated[ Optional[List[Literal["g4"]]], Field( - description=("The list of preview GCP features to enable."), + description=("The list of preview GCP features to enable. Supported values: `g4`"), max_items=1, ), ] = None