Skip to content

Commit 62e9800

Browse files
committed
wip(workgraph): use node name in function signature
1 parent 997347f commit 62e9800

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

include/luisa/dsl/work_graph/work_graph.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class WorkGraphNode {
9292

9393
// yoink the function builder, make sure type of input record matches what we were declared with
9494
inner()->fn_builder = kernel.function_builder();
95+
inner()->fn_builder->set_name(inner()->name);
9596
inner()->defined = true;
9697
}
9798

src/backends/common/hlsl/codegen_utils/work_graph_codegen.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ void CodegenUtility::CodegenWorkGraphNode(const WorkGraph &work_graph, size_t no
294294
GenerateNodeShaderAttributes(is_entry_point, node.name, result);
295295

296296
// Generate node function signature
297+
// use actual name from frontend here, rather than custom_<i>, since node names are meaningful
298+
LUISA_ASSERT(!node_func.name().empty(), "work graph node's FunctionBuilder has invalid name");
297299
result << "void "sv << node_func.name() << "(\n"sv;
298300

299301
// Generate node function parameters using helper

src/dsl/work_graph/work_graph.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ LUISA_DSL_API WorkGraph WorkGraphBuilder::build() noexcept {
5959
luisa::unordered_set<luisa::string_view> node_names;
6060
for (auto const& node : _nodes) {
6161
auto [_, name_unique] = node_names.insert(node.name);
62+
LUISA_ASSERT(!node.name.empty(), "names of work graph nodes cannot be empty");
6263
LUISA_ASSERT(name_unique, "names of work graph nodes must be unique");
6364
}
6465

0 commit comments

Comments
 (0)