11#pragma once
22
3+ #include < cstddef>
4+
35#include < luisa/core/dll_export.h>
46#include < luisa/core/stl/string.h>
57#include < luisa/core/stl/unordered_map.h>
@@ -25,6 +27,14 @@ struct CoroMaterializeInfo {
2527 size_t suspend_lowered_count{0u };
2628 size_t resume_lowered_count{0u };
2729 size_t terminal_lowered_count{0u };
30+ // Coro materialization is an unstructured-CFG-only transform. A non-zero
31+ // value means the complete request was rejected before any IR was mutated.
32+ size_t structured_cfg_error_count{0u };
33+ size_t invalid_input_error_count{0u };
34+
35+ [[nodiscard]] bool succeeded () const noexcept {
36+ return structured_cfg_error_count == 0u && invalid_input_error_count == 0u ;
37+ }
2838
2939 struct TransitionEdge {
3040 size_t from_scope{0u };
@@ -37,6 +47,12 @@ struct CoroMaterializeInfo {
3747 luisa::unordered_map<luisa::string, const Type *> name_to_type;
3848};
3949
50+ // These entry points require lower_switch followed by destructure_cfg. SWITCH
51+ // is conservatively rejected even when its merge is null. Rejection is atomic:
52+ // no matching callable in the module is materialized. The split-aware overload
53+ // also rejects missing/duplicate/out-of-range scopes, duplicate/null/foreign
54+ // callables, and a frame argument that is not the callable's own reference
55+ // argument.
4056[[nodiscard]] LUISA_XIR_API CoroMaterializeInfo coro_materialize_pass_run_on_module (Module *m) noexcept ;
4157[[nodiscard]] LUISA_XIR_API CoroMaterializeInfo coro_materialize_pass_run_on_module_with_cfg (
4258 Module *m, const CoroCfgDistillResult &cfg) noexcept ;
0 commit comments