Skip to content

[UR][CUDA][HIP] Add UR_{CUDA,HIP}_STACK_SIZE env var for per-thread s… - #22763

Open
zjin-lcf wants to merge 1 commit into
intel:syclfrom
zjin-lcf:ur-device-stack-size
Open

[UR][CUDA][HIP] Add UR_{CUDA,HIP}_STACK_SIZE env var for per-thread s…#22763
zjin-lcf wants to merge 1 commit into
intel:syclfrom
zjin-lcf:ur-device-stack-size

Conversation

@zjin-lcf

Copy link
Copy Markdown
Contributor

…tack size

Add support for configuring the per-thread device stack size limit at device initialization via the UR_CUDA_STACK_SIZE and UR_HIP_STACK_SIZE environment variables. These map to cuCtxSetLimit(CU_LIMIT_STACK_SIZE) and hipDeviceSetLimit(hipLimitStackSize) respectively (the driver-level equivalent of cudaDeviceSetLimit(cudaLimitStackSize)), which is useful for kernels with deep recursion or large per-thread private data that would otherwise overflow the small default stack.

An invalid value (non-positive or non-numeric) is rejected with a diagnostic at device initialization. Documentation and an E2E test covering the invalid/valid cases are included.

Addresses #12271

…tack size

Add support for configuring the per-thread device stack size limit at
device initialization via the UR_CUDA_STACK_SIZE and UR_HIP_STACK_SIZE
environment variables. These map to cuCtxSetLimit(CU_LIMIT_STACK_SIZE)
and hipDeviceSetLimit(hipLimitStackSize) respectively (the driver-level
equivalent of cudaDeviceSetLimit(cudaLimitStackSize)), which is useful
for kernels with deep recursion or large per-thread private data that
would otherwise overflow the small default stack.

An invalid value (non-positive or non-numeric) is rejected with a
diagnostic at device initialization. Documentation and an E2E test
covering the invalid/valid cases are included.

Addresses intel#12271

Co-authored-by: Cursor <cursoragent@cursor.com>
@zjin-lcf
zjin-lcf requested review from a team as code owners July 24, 2026 20:31
@zjin-lcf
zjin-lcf requested a review from pbalcer July 24, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant