Skip to main content
By default, a GPU CVM attests its GPUs through NVIDIA on every boot and includes the result in its attestation. You can set a GPU policy in your app compose to skip GPU attestation on any GPU CVM (including H200), or to enable profiling and debugging tools on B200 and B300 GPUs. GPU policies require a GPU instance type and dstack OS 0.6.0 or newer. The phala gpu-policy command requires Phala Cloud CLI 1.3.0-beta.1 or newer.

How it works

A GPU policy is stored under requirements.gpu_policy in your app compose:
Phala Cloud stores this object verbatim in the compose. Because the compose is covered by the compose hash in the CVM’s attestation, changing the policy produces a new compose hash that verifiers can check against the compose. If you omit gpu_policy, full GPU attestation runs by default.

Configurations

{"attest_gpu": false} works on all GPU instance types (including H200). Only DevTools changes the GPU mode, and only on B200 and B300 GPUs. On other GPUs, the DevTools policy keeps the normal confidential mode and works like attestation off. By default, GPUs run with confidential computing enabled (or protected PCIe mode on 8-GPU H200 machines); disabling confidential computing altogether is not supported. Use DevTools only for development and profiling, never with private data. Other supported keys have no CLI presets and must be passed as raw JSON via the API, phala deploy --gpu-policy-file, or phala gpu-policy set --file / --stdin:
  • allow_debug (boolean): Not recommended; currently has no effect with the GPU attestation tool.
  • allow_insecure_boot (boolean): Not recommended; currently has no effect with the GPU attestation tool.
  • rego (string): A Rego v0 policy in package policy that defines the boolean rule data.policy.nv_match. Its input is the GPU attestation claims array. It also runs when attest_gpu is false, with an empty array as input, so a rule that requires GPU claims stops the CVM from booting. See the dstack GPU security model.

Eligibility

Only CVMs on a GPU instance type running dstack OS 0.6.0 or newer support a GPU policy:
  • CPU-only CVMs: Sending a policy object fails with ERR-03-075. Sending null is always accepted so you can clear a mistakenly stored policy.
  • dstack OS 0.5.x: Rejected unless you upgrade to dstack OS 0.6.0 or newer in the same request.
Because a GPU CVM cannot change its GPU type or count after creation, it remains eligible for its lifetime.

Set a policy on create

CLI

Pass --gpu-policy (attestation-off or devtools) to phala deploy:
To pass a custom JSON policy object from a file, use --gpu-policy-file:
--gpu-policy and --gpu-policy-file are mutually exclusive, and neither can be combined with --app-compose (define requirements.gpu_policy directly in your app compose file instead).

API

Include requirements.gpu_policy inside compose_file in POST /cvms:
Boolean fields must be JSON booleans (not strings). Unknown keys and empty rego strings fail with HTTP 422.

Update an existing CVM

Set or replace the policy with phala gpu-policy or PATCH /cvms/{cvm_id}:
To remove the policy and return to full GPU attestation:
You can also replace the policy on an existing CVM with phala deploy --cvm-id <cvm-name-or-id> -c docker-compose.yml --gpu-policy-file gpu-policy.json. To remove a policy, use phala gpu-policy reset (phala deploy has no reset flag).

Replacement rules

Unlike other objects in compose, which merge key by key, requirements.gpu_policy is replaced as a whole on PATCH /cvms/{cvm_id}: For example, if the stored policy is {"allow_devtools": true, "attest_gpu": false} and you patch with {"attest_gpu": false}, allow_devtools is dropped. Sending "requirements": null clears every key under requirements, including gpu_policy. Passing {} or setting a field to null (such as {"rego": null}) fails with 422. Send "gpu_policy": null to reset, or omit keys you do not want. Empty or whitespace-only rego strings are rejected on both create and update.

Restarts, no-ops, and Onchain KMS

Updating the policy restarts a running CVM (stopping it, writing the new compose, and starting it again, which takes a few minutes). A stopped CVM stays stopped and picks up the new policy on its next start. If the policy you send matches the stored policy’s exact keys and values, nothing changes and the CVM does not restart. Because the comparison is literal rather than semantic, {"attest_gpu": false} and {"attest_gpu": false, "allow_devtools": false} produce different compose hashes and trigger a restart. On Onchain KMS, register the new compose hash on your app contract before applying the update, just like any other compose change. See What changes for a CVM on Onchain KMS?.

Staging with other changes

To combine a policy change with other updates in a single restart, stage it first and apply the draft together:
If you stage multiple policy changes, the last one wins; staging null overrides an earlier staged policy so the policy is removed on apply. See How do I stage several changes and restart once?.

Inspect the current policy and GPU mode

This prints the stored policy, the configuration it matches, OS support status, and any staged policy change. It also prints the expected GPU mode alongside the host-observed mode (Observed GPU mode) for each GPU. Check Observed GPU mode in phala gpu-policy show to see whether DevTools mode is active. Inside the CVM, nvidia-smi conf-compute shows the CC state as ON in both modes. Via the API, read compose_file.requirements.gpu_policy from GET /cvms/{cvm_id}. Starting in API version 2026-11-11, pass include_compose=true to include compose_file in the response.

Recover from GPU boot failures

If GPU attestation fails at boot, the CVM does not finish booting. The node retries the boot a few times, then the CVM stays stopped. Because a stopped CVM still accepts policy updates, you can temporarily disable GPU attestation and start it again:
  • If a start is still in progress, stop the CVM first with phala cvms stop, then run the two commands above.
  • On Onchain KMS, register the new compose hash on your app contract before starting (the update will report it if missing).
  • Once the underlying issue is resolved, run phala gpu-policy reset to restore full GPU attestation.

Errors

Requests targeting a CVM on dstack OS 0.5.x are also rejected. Upgrade to dstack OS 0.6.0 or newer first.