Skip to content

feat(dxil): 104 golden diff=0, 54.5% parity — loadInput DCE, QuantizeF16, sigId fixes#69

Merged
kolkov merged 7 commits into
mainfrom
feat/dxil-parity-v0179
Apr 30, 2026
Merged

feat(dxil): 104 golden diff=0, 54.5% parity — loadInput DCE, QuantizeF16, sigId fixes#69
kolkov merged 7 commits into
mainfrom
feat/dxil-parity-v0179

Conversation

@kolkov

@kolkov kolkov commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Summary

DXIL parity push: 94→104 diff=0 (+10), parity 48.1%→54.5% (+6.4pp). Crossed 100 diff=0 and 50% parity milestones.

Optimizations

  • Per-member loadInput DCE — backwards reachability eliminates unused struct input loads
  • Zero-store local promotion — unassigned struct members resolve to zero constants
  • QuantizeF16 via legacy opsdx.op.legacyF32ToF16/F16ToF32, eliminates NativeLowPrecision flag cascade (13 shaders)
  • Same-type cast eliminationbitcast i32↔i32 is no-op
  • Strength reductionsub X,Cadd X,-C, mul X,2^Nshl X,N

Bug fixes

  • Input sigId — element index, not register row (fixes packed inputs)
  • ViewID StartCol — packed linear indexing includes column offset
  • Cross-argument struct ordering — reverse signature order globally
  • Int64 flag — scanned from emitted bitcode, not IR types
  • createHandle — always use opcode 57, removed dead createHandleFromBinding path
  • MSVC groupshared names\01?name@@3typeA decoration

Metrics

Metric v0.17.8 This PR
DXC golden diff=0 94 104 (+10)
Line parity 48.1% 54.5% (+6.4pp)
IDxcValidator 161/170 161/170
gg production 58/59 58/59
Text backends 100% 100%

Test plan

  • go build ./...
  • go test ./dxil/... -count=1 — all pass
  • go test -run TestDxilValSummary — 161/170
  • go test -run TestDxilDxcGolden — 104 diff=0
  • go test -run TestRustReference — 100%
  • golangci-lint run --timeout=5m — clean
  • CI green

kolkov added 6 commits April 30, 2026 16:24
…n — +2 golden diff=0

Zero-store local promotion: unassigned struct members resolve to zero.
Same-type integer cast elimination: bitcast i32↔i32 is no-op.
Sub→add canonicalization: sub X,C → add X,-C for positive constants.
Mul→shl strength reduction: mul X,2^N → shl X,N.
Normalizer: strip nsw/nuw/exact integer flags, fast on fcmp.
96 diff=0 (was 94), 48.6% parity (was 48.1%), +125 lines.
…golden diff=0

usedStructMembers() with computeLiveExprs() backwards analysis eliminates
dx.op.loadInput calls for struct input members never consumed by shader body.
Handles post-inlining patterns where intermediate expressions fall outside
StmtEmit ranges. 98 diff=0 (was 96), 49.6% parity (was 48.6%), +288 lines.
Newly diff=0: skybox/fs_main, msl-vpt-formats-x1/render_vertex.
…0 golden diff=0

Three bugs: (1) sigId used register row instead of element index — broke
packed inputs sharing same row. (2) ViewID inScalarToComp ignored StartCol
offset. (3) Cross-argument struct inputs emitted in declaration order,
DXC emits reverse signature order. 100 diff=0 (was 98), 49.6% parity.
Newly diff=0: unconsumed_vertex_outputs_frag/fs_main, mesh-shader/fs_main.
…upshared names — 103 golden diff=0

QuantizeF16 via dx.op.legacyF32ToF16/F16ToF32 (not fptrunc/fpext) —
eliminates NativeLowPrecision flag, fixes 13-shader header cascade.
Int64 flag scanned from emitted module, not IR types. AtomicInt64OnHeapResource
flag for 64-bit atomics on non-workgroup resources. MSVC name decoration
for workgroup variables. 103 diff=0 (was 100), 54.3% parity (was 49.6%).
…n diff=0

Always use createHandle (opcode 57), removed unused createHandleFromBinding
path + 9 dead functions. SM version normalized in golden comparison.
AtomicInt64OnHeapResource flag test. 104 diff=0 (was 103), 54.5% parity.
@codecov

codecov Bot commented Apr 30, 2026

Copy link
Copy Markdown

@kolkov kolkov merged commit 6f1ddcf into main Apr 30, 2026
11 checks passed
@kolkov kolkov deleted the feat/dxil-parity-v0179 branch May 8, 2026 19:05
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