Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/srdatalog/ir/codegen/cuda/complete_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,9 @@ def gen_complete_runner(
"",
)
decl += decl_aliases
if node.dedup_hash:
# LaunchParams stores the table by value, so main needs its full definition.
decl += _gen_dedup_table_struct(node)
decl += _gen_launch_params_struct(
len(node.dest_specs),
is_fused_eligible,
Expand Down
23 changes: 23 additions & 0 deletions tests/test_integration_ddisasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
import sys
from pathlib import Path

import pytest
from integration_helpers import FIXTURES, diff_hir, diff_mir

from srdatalog import build_project

sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "examples"))
from ddisasm import build_ddisasmdb_program

Expand All @@ -37,6 +40,26 @@ def test_ddisasm_mir():
diff_mir(build_ddisasm(), "ddisasm")


@pytest.mark.parametrize("layout", ["split", "sharded", "unity"])
def test_ddisasm_dedup_type_defined_before_use(tmp_path, layout):
project = build_project(
build_ddisasm(),
"DdisasmPlan",
cache_base=str(tmp_path),
shard_step_bodies=layout == "sharded",
unity=layout == "unity",
)
checked = 0
for path in [project["main"], *project["batches"]]:
cpp = Path(path).read_text()
if "DedupTable dedup_table{};" not in cpp:
continue
assert cpp.count("struct DedupTable {") == 1, path
assert cpp.index("struct DedupTable {") < cpp.index("DedupTable dedup_table{};"), path
checked += 1
assert checked > 0


if __name__ == "__main__":
test_ddisasm_hir()
test_ddisasm_mir()
Expand Down
Loading