compiler: one build_module/set_params path for all three module owners
Simulation, PeriodicBlockStepper and FixedPatchStepper levels each repeated generate_config -> compile_kernel -> load_module -> cleanup and the d_params pack/upload. They now call compiler.build_module(cfg, entry, arch=..., n_objects=..., block_root_bc=...) and compiler.set_params. Simulation no longer keeps its build directory alive until close (nothing read it after loading). Removes the unused compile_kernel_v2 alias. Host fakes and lifecycle tests follow the new seam; the close-retry case for build-directory cleanup goes with the removed cleanup step. No kernel, numerical or launch change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
96c5decf69
commit
0d62c3cfb8
14 files changed
+51
-67
No files matched your search
@@ -74,7 +74,7 @@ def test_evolved_ghost_snapshot_and_physical_download():
|
||||
from .test_refinement_three_level_multipatch import host_module
|
||||
host = host_module()
|
||||
storage = {}
|
||||
host.compiler.load_module.return_value.get_global.side_effect = lambda name: (name, 12 if name == "d_block_channel" else 20)
|
||||
host.compiler.build_module.return_value.get_global.side_effect = lambda name: (name, 12 if name == "d_block_channel" else 20)
|
||||
host.cuda.mem_alloc.side_effect = lambda size: Mock()
|
||||
host.cuda.memcpy_htod.side_effect = lambda ptr, a: storage.__setitem__(id(ptr), np.array(a, copy=True))
|
||||
host.cuda.memcpy_dtoh.side_effect = lambda a, ptr: np.copyto(a, storage[id(ptr)])
|
||||
@@ -96,7 +96,7 @@ def test_evolved_ghost_snapshot_and_physical_download():
|
||||
arrays[0][0, 0, 0] = np.nan
|
||||
with pytest.raises(ValueError, match="finite"):
|
||||
backend.initialize(*arrays)
|
||||
assert backend._levels[0].kernel == host.compiler.load_module.return_value.get_function("BlockChannelStep")
|
||||
assert [call.kwargs["block_root_bc"] for call in host.compiler.generate_config.call_args_list] == [2, 0]
|
||||
assert backend._levels[0].kernel == host.compiler.build_module.return_value.get_function("BlockChannelStep")
|
||||
assert [call.kwargs["block_root_bc"] for call in host.compiler.build_module.call_args_list] == [2, 0]
|
||||
finally:
|
||||
backend.close()
|
||||
Reference in new issue
Block a user