Skip to content

JIT: C++ modules and Agility SDK in the shared interop; tslang pre-alpha93 fixes - #34

Merged
ASDAlexander77 merged 2 commits into
mainfrom
jit-fixes
Oct 11, 2026
Merged

ASDAlexander77 merged 2 commits into
mainfrom
jit-fixes

Conversation

@ASDAlexander77

@ASDAlexander77 ASDAlexander77 commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Checks the new tslang (v0.0-pre-alpha93) and fixes the examples that couldn't run under the JIT.

The new tslang

  • Everything compiles; 57/57 tests pass.
  • JIT cache crash: with the JIT cache on (the default), a run that has to compile two or more modules crashes tslang with 0xC0000005, after writing the first module's object. Each crashing run caches one more module, so an example crashed on its first two runs: it, core/input_pass.ts and core/donut.ts are three modules.
    • Minimal repro: useslib.ts doing import { twice } from "./lib". It crashes from an empty cache and prints twice 42 on the next run, or with --jit-cache=false.
    • Workaround: run_jit.bat now passes --jit-cache=false. The README documents it, and that program arguments go after --.
    • Reported as TypeScriptCompiler#548.
  • New warning: it now warns when a number is stored into a variable inferred as s32 from an integer literal. There were 36 sites:
    • 35 hold integers by construction (parseInt, Math.floor, Math.max of integers) and are now declared int. Same type as before; the warning is gone.
    • 1 was a real truncation: multithreading's checkFrame summed each pixel's fractional average into an integer. It is now a number.

JIT: missing symbols (16 examples)

Under the JIT, donut_interop.dll is all an example gets, and it held only core/donut_interop.cpp. These examples failed with JIT session error: Symbols not found:

Module Examples
core/sdkmesh.cpp bokeh, raytracing_ao, simple_pbr, mouse_cursor
core/meshlet_model.cpp meshlet_render, meshlet_cull, meshlet_instancing, dynamic_lod
core/basis_transcoder.cpp texture_compression_basisu, texture_compression_comparison
core/obj_model.cpp sakura_forest_ser
core/paged_images.cpp memory_management
core/video_player.cpp video_texture
core/fast_block_compress.cpp fast_block_compress
core/denoised_rtao.cpp (PBRT) denoised_rtao
core/directx_collision.cpp collision

The shared library now builds these modules in. It links basisu_transcoder, and on Windows delay-loads mfplat.dll as video_texture does. The normal executables are unchanged.

JIT: Agility SDK

Executables that need the Agility SDK runtime export D3D12SDKVersion/D3D12SDKPath (core/d3d12_agility_sdk.cpp). Under the JIT the process is tslang.exe, which has no such exports, so they got the system runtime. sakura_forest_ser failed with "Device doesn't support Shader Model 6.9".

The shared library, and only it, now applies bin/D3D12's runtime before the first device: ID3D12SDKConfiguration1::CreateDeviceFactory + ApplyToGlobalState. It only does this when the executable doesn't opt in itself.

Verification

  • Symbols: every example's Donut_* references now resolve against the DLL's exports (887, up from 766).
  • JIT runs: with the same arguments CTest uses, these pass their -test runs:
    • meshlet_render, meshlet_cull, meshlet_instancing, dynamic_lod and denoised_rtao (×3), on both dx12 and vk;
    • sakura_forest_ser, all 4 sort modes, on the Agility runtime 619;
    • memory_management, all 3 variants;
    • generic_programs and host_image_copy.
  • Without a headless mode: bokeh, raytracing_ao, simple_pbr, mouse_cursor, collision, fast_block_compress, texture_compression_* and video_texture are covered by the symbol check only.
  • Normal build: no warnings, 57/57 tests.

🤖 Generated with Claude Code

…g pre-alpha93 fixes

Under tslang's JIT, donut_interop.dll is all an example gets, and it held
core/donut_interop.cpp only: 16 examples failed with "Symbols not found"
(the OBJ/SDKMESH/meshlet loaders, PBRT scene, DirectXCollision, Basis
transcoder, fast block compressor, paged images, video player). The
shared library now builds them in (basisu_transcoder linked, mfplat.dll
delay-loaded as video_texture's).

Examples whose executables opt into the Agility SDK runtime (exports
D3D12SDKVersion/D3D12SDKPath) got the system's under the JIT, where the
process is tslang.exe: sakura_forest_ser failed on shader model 6.9. The
shared library (only) now applies bin/D3D12's runtime with
ID3D12SDKConfiguration1::CreateDeviceFactory + ApplyToGlobalState before
the first device, when the executable doesn't opt in itself.

tslang pre-alpha93:
- Its JIT cache crashes (0xC0000005) on any file importing another .ts
  file (every example): run_jit.bat passes --jit-cache=false; README
  documents it and that program arguments go after "--".
- It now warns when a number is stored into a variable inferred as s32
  from an integer literal (36 sites): 35 hold integers by construction and
  are declared int; multithreading's checkFrame sum was truncating each
  pixel's fractional average and is now a number.

Verified: everything compiles with the new tslang, no warnings, 57/57
tests; under the JIT every example's Donut_* references resolve (887
exports, was 766), and meshlet_render/cull/instancing, dynamic_lod,
denoised_rtao (dx12 and vk), sakura_forest_ser (4 sort modes),
memory_management (3 variants), generic_programs and host_image_copy
pass their -test runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…odules)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit a3c6e82 into main Oct 11, 2026
@ASDAlexander77
ASDAlexander77 deleted the jit-fixes branch October 11, 2026 15:34
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