Skip to content

[Build] Reduce concurrency#75

Merged
hughperkins merged 6 commits into
mainfrom
hp/reduce-concurrency
Jul 11, 2025
Merged

[Build] Reduce concurrency#75
hughperkins merged 6 commits into
mainfrom
hp/reduce-concurrency

Conversation

@hughperkins

Copy link
Copy Markdown
Collaborator

Issue: #

Brief Summary

copilot:summary

Walkthrough

copilot:walkthrough

Comment thread .github/workflows/macosx.yml Outdated
@hughperkins hughperkins force-pushed the hp/reduce-concurrency branch from 72d2311 to 71fe598 Compare July 11, 2025 04:24
@hughperkins

Copy link
Copy Markdown
Collaborator Author

Thanks!

@hughperkins hughperkins merged commit 32f9f9d into main Jul 11, 2025
36 checks passed
@hughperkins hughperkins deleted the hp/reduce-concurrency branch July 11, 2025 16:29
hughperkins added a commit that referenced this pull request May 10, 2026
`qd.clz(u32_value)` was emitting QD_NOT_IMPLEMENTED on CUDA and produced
undefined results on SPIR-V (GLSL.std.450 FindSMsb is undefined for the
all-bits-set case).  The new `subgroup.segmented_reduce_add` is the
first user of `clz` in the codebase and exposed both bugs.

* CUDA: route u32 / u64 inputs through the same `__nv_clz` / `__nv_clzll`
  intrinsics used for i32 / i64 — the underlying bit pattern is what
  matters, the C declaration on signed types is a header-level
  convention.
* SPIR-V: dispatch to FindUMsb (#75) for unsigned inputs and FindSMsb
  (#74) for signed.  The two GLSL.std.450 instructions return a value
  of the same type as their operand, so add an explicit OpBitcast back
  to i32 before the `32 - msb - 1` subtraction (otherwise SPIR-V's
  strict-type `sub` asserts on mixed i32 / u32).
* Python: in `segmented_reduce_add`, wrap `clz`'s result in `i32(...)`
  so the subsequent arithmetic is uniformly signed-32-bit (the trace-
  time tracer would otherwise propagate u32 from the input through to
  the subtraction, hitting SPIR-V's same-type assertion).

Tests: `subgroup.segmented_reduce_add` tests now pass on CUDA + Vulkan
across i32 / i64 / u64 / f32 / f64 and `log2_size` in [0..5], including
the all-heads, no-heads, and truthy-predicate edge cases.
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.

3 participants