Skip to content

SCALE on AMD is missing the CUDA Green Contexts driver API #54

Description

@diskdog

SCALE 1.7.1 and the 2026.07.02 nightly, AMD target (gfx1100), compile-only. NVIDIA target and nvcc 13.1 are fine.

SCALE's AMD target advertises CUDA 12.9 (CUDA_VERSION preprocesses to 12 * 1000 + 9 * 10) but does not declare the Green Contexts driver API that CUDA gained in 12.4. Code that gates on the advertised version, like pytorch's c10/cuda/driver_api.h, enables the API and then fails to compile.

Missing: CUdevResourceDesc, cuGreenCtxCreate, cuGreenCtxDestroy, cuGreenCtxStreamCreate, cuCtxFromGreenCtx, CU_GREEN_CTX_DEFAULT_STREAM. (The CUgreenCtx type itself is declared in redscale_impl/hostapi.h; it is the create / destroy / stream entry points and the default-stream constant that are absent.)

repro.cu:

#include <cuda.h>
static_assert(CUDA_VERSION >= 12040, "both compilers advertise >= 12.4");
int main() {
  CUgreenCtx gc = nullptr;
  CUdevResourceDesc desc = nullptr;
  CUresult r = cuGreenCtxCreate(&gc, desc, 0, CU_GREEN_CTX_DEFAULT_STREAM);
  if (r == CUDA_SUCCESS) cuGreenCtxDestroy(gc);
  CUstream s;
  cuGreenCtxStreamCreate(&s, gc, CU_STREAM_NON_BLOCKING, 0);
  CUcontext c;
  cuCtxFromGreenCtx(&c, gc);
  return 0;
}
nvcc -std=c++17 -c repro.cu                          ok
targets/gfx1100/bin/nvcc -std=c++17 -c repro.cu      error: unknown type name 'CUdevResourceDesc'; did you mean 'cudaResourceDesc'?
llvm/bin/nvcc -arch=sm_75 -std=c++17 -c repro.cu     ok (NVIDIA target has it)

Both SCALE versions fail identically, so this is a longstanding gap rather than a regression. Same family as the SM-resource partitioning API gap reported separately; split out because the symbol sets fail different pytorch translation units.

Likely cause: targets/gfx1100/include/cuda.h predates the 12.4 Green Contexts additions while redscale_impl/version.h pins the advertised version at 12.9. Either declaring the API or advertising the version SCALE actually covers would unbreak version-guarded callers.

Found building pytorch v2.12.1 (scale-validation pytorch entry bumped from v2.9.0): fails CUDAAllocatorConfig.cpp, CUDACachingAllocator.cpp, PeerToPeerAccess.cpp, driver_api.cpp, CUDAGreenContext.cpp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Missing APIA CUDA API we haven't implemented yet.VerifiedInternal QA verifies the bug reproduces on the current dev build.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions