Repository navigation
[Fix][WebGPU] Validate and bound symbolic stack allocations - #20132
Merged
tlopex merged 1 commit intoAug 19, 2026
Merged
Conversation
tlopex
approved these changes
Aug 19, 2026
wodylm
pushed a commit
to wodylm/mcTVM
that referenced
this pull request
Sep 15, 2026
…0132) Allow WebGPU code generation for local and workgroup allocations whose symbolic extents have finite compile-time upper bounds. WGSL requires array lengths to be compile-time constants, so codegen uses arithmetic analysis to derive and emit a static upper bound for expressions such as `min(n, 64)` (unbounded or nonpositive extents are rejected). This PR: - Detects element-count, byte-size, and aggregate workgroup-memory overflow - Computes allocation sizes using WGSL array element stride - Applies WebGPU's per-workgroup-variable 16-byte size rounding - Tracks total workgroup storage used by each generated entry point - Enforces `max_shared_memory_per_block`, corresponding to WebGPU's `maxComputeWorkgroupStorageSize` - Sets the default WebGPU limit to 32 KiB to match TVM's JavaScript runtime contract while permitting target-specific overrides
tqchen
pushed a commit
that referenced
this pull request
Oct 16, 2026
Allow WebGPU code generation for local and workgroup allocations whose symbolic extents have finite compile-time upper bounds. WGSL requires array lengths to be compile-time constants, so codegen uses arithmetic analysis to derive and emit a static upper bound for expressions such as `min(n, 64)` (unbounded or nonpositive extents are rejected). This PR: - Detects element-count, byte-size, and aggregate workgroup-memory overflow - Computes allocation sizes using WGSL array element stride - Applies WebGPU's per-workgroup-variable 16-byte size rounding - Tracks total workgroup storage used by each generated entry point - Enforces `max_shared_memory_per_block`, corresponding to WebGPU's `maxComputeWorkgroupStorageSize` - Sets the default WebGPU limit to 32 KiB to match TVM's JavaScript runtime contract while permitting target-specific overrides
tqchen
pushed a commit
that referenced
this pull request
Oct 18, 2026
Allow WebGPU code generation for local and workgroup allocations whose symbolic extents have finite compile-time upper bounds. WGSL requires array lengths to be compile-time constants, so codegen uses arithmetic analysis to derive and emit a static upper bound for expressions such as `min(n, 64)` (unbounded or nonpositive extents are rejected). This PR: - Detects element-count, byte-size, and aggregate workgroup-memory overflow - Computes allocation sizes using WGSL array element stride - Applies WebGPU's per-workgroup-variable 16-byte size rounding - Tracks total workgroup storage used by each generated entry point - Enforces `max_shared_memory_per_block`, corresponding to WebGPU's `maxComputeWorkgroupStorageSize` - Sets the default WebGPU limit to 32 KiB to match TVM's JavaScript runtime contract while permitting target-specific overrides
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow WebGPU code generation for local and workgroup allocations whose symbolic extents have finite compile-time upper bounds. WGSL requires array lengths to be compile-time constants, so codegen uses arithmetic analysis to derive and emit a static upper bound for expressions such as
min(n, 64)(unbounded or nonpositive extents are rejected).This PR:
max_shared_memory_per_block, corresponding to WebGPU'smaxComputeWorkgroupStorageSize