Retype matrix layout generic param from int to MatrixLayoutMode (for slang#12840) - #1135
Retype matrix layout generic param from int to MatrixLayoutMode (for slang#12840)#1135nv-slang-bot[bot] wants to merge 1 commit into
Conversation
shader-slang/slang#12840 retypes the built-in matrix layout parameter from `int` to the new `MatrixLayoutMode` enum (a breaking change). No implicit int->enum conversion exists, so SlangPy's generic extensions over `matrix<T, R, C, L>` that declare the layout param as `int` fail to type-check against the new declaration (E30019: expected 'MatrixLayoutMode', got 'int'). Retype the layout param to `MatrixLayoutMode` at both sites so the extensions unify against the retyped matrix type: - slangpy/slang/staticarray.slang: ISizedArray extension - src/sgl/device/print.slang: IPrintable extension
|
Automated notice (PR board sync) — do not reply to this comment. Auto-assigned @kaizhangNV as shepherd for this Bot PR. FYI for maintainers: committer signal on the changed files is highest for skallweitNV among collaborators other than the assignee. They were not auto-requested; a human may optionally add them as a reviewer. |
|
CI on this draft is red as expected — this is the documented cross-repo blocker (see Merge order above), not a regression. The C++ unit tests compile
🤖 Generated by an automated SlangPy coworker — may be inaccurate. A human maintainer should verify. |
fknfilewalker
left a comment
There was a problem hiding this comment.
LGTM, thats exactly how I fixed it for me locally.
|
Thanks @fknfilewalker — confirmation that this matches your local fix is effectively the execution proof I couldn't produce in CI (SlangPy's own build can't compile it until the pinned Keeping this as a draft on purpose: merging to 🤖 Generated by an automated SlangPy coworker — may be inaccurate. A human maintainer should verify. |
Summary
dev/slangpy-fixer/matrix-layout-mode; promoted to ready-for-review by maintainer @jkwak-work (2026-09-04).SGL_SLANG_VERSIONpin bump lands (see Merge order) — on pinned Slang2026.16.1this hard-breaks SlangPy CI and every user on the pinned release..slangextensions overmatrix<T, R, C, L>declare the layout param asint; after slang#12840 retypes the built-in matrix layout param to the newMatrixLayoutModeenum they no longer type-check (E30019: expected 'MatrixLayoutMode', got 'int'— no implicitint→enum). Retyped both toMatrixLayoutMode.SGL_LOCAL_SLANGbuild (see Validation below), then execute the cross-repo Merge order.MatrixLayoutMode; breaking the cycle needs one maintainer merge-gate override (see below).Motivation
shader-slang/slang#12840 ("Fix bug in matrix specialization", labeled pr: breaking change) retypes the built-in
matrixlayout generic parameter fromintto a new enum:Slang does not implicitly convert
int→MatrixLayoutMode, so any generic extension that binds the matrix layout param withlet L : intfails to unify against the retypedmatrixtype. SlangPy has exactly two such sites (full-tree scan oforigin/main), both compiled at module-load / dispatch time:slangpy/slang/staticarray.slang:10—ISizedArrayextension overmatrix<T, R, C, L>src/sgl/device/print.slang:260—IPrintableextension overmatrix<T, R, C, L>This is the sole cause of the red "SlangPy Tests" check on slang#12840. It is a type-check-time break, independent of the column-major codegen concern discussed on that PR.
Change
Retype the layout param
let L : int→let L : MatrixLayoutModeat both sites. This mirrors exactly what slang#12840 does to its ~15 core-module matrix extension declarations. Coverage is preserved: the extension still binds the layout param generically, so it applies to all layout modes (unlike dropping the param, which would bind only the defaultUnknownlayout).MatrixLayoutModeis a core-module global enum, so it is visible in these modules with no additional import.Validation (before merge, no merge needed)
The retype only compiles against a Slang that defines
MatrixLayoutMode, which is unreleased (it lives in #12840). Validate this branch against #12840 with a local Slang build — the same mechanism CI uses (.github/actions/build-and-test-with-slangconfigures with-DSGL_LOCAL_SLANG=ON):Merge order (required — please read)
The "SlangPy Tests" check on slang#12840 is posted by SlangPy's
ci-latest-slang.yml, which checks out SlangPy's default branch and builds it against the PR's Slang (pr mode). So that check only turns green once this retype is onmain. But SlangPy's own CI (ci.yml) builds against the downloaded pinned releaseSGL_SLANG_VERSION = 2026.16.1(external/CMakeLists.txt:95), which predates #12840 and has noMatrixLayoutMode— so this retype cannot pass SlangPy's own CI until that pin points at a Slang release containing the enum. Each repo's green gate depends on a state only the other repo can provide first: a genuine circular dependency that needs exactly one manual gate-override to break. Recommended sequence:master, overriding its red "SlangPy Tests" check — a known, expected, coordinated cross-repo break (this is the one manual override that breaks the cycle; the maintainer requested this companion PR precisely because of it).SGL_SLANG_VERSION→ the new release alongside this retype. SlangPy's own CI then downloads the enum-containing Slang, the retype compiles, and the check goes green.(The pin bump is intentionally not in this PR yet — the target release does not exist, so bumping now would 404 the download. It must be added in step 4.)
If instead you prefer to green #12840's check before merging it, swap the order: admin-merge this retype PR to SlangPy
mainfirst (overriding SlangPy's own redci.yml), then re-trigger "SlangPy Tests" on #12840 — merging SlangPy does not auto-rerun the previously-failed status; re-run it via the slang-sideci-slangpy-trigger-test.ymlworkflow_dispatch(pr_number=12840) or by pushing a new commit to #12840. This variant leaves SlangPymainred against the pinned 2026.16.1 until the pin bump (step 4) lands, so the sequence above is preferred.Testing
No new test is added: this is a compatibility retype of two core
.slangmodules, both already exercised by the existing suite (staticarray.slangloads with the SlangPy module;print.slangcompiles when the debug printer is used). The authoritative proof is the localSGL_LOCAL_SLANGbuild against #12840 (see Validation). That build was not run in this automated session (it requires the unreleased compiler plus a full Slang + SlangPy build); correctness here rests on exact correspondence to #12840's own core-module changes (identicalint→MatrixLayoutModeretype applied to ~15 matrix extension declarations) plus diff review. Please run the Validation build before promoting out of draft.🤖 Generated by an automated SlangPy coworker — may be inaccurate. A human maintainer should verify.