bloqade.gemini.common.validation.recursion.NoOpaqueCallValidation
classNoOpaqueCallValidation¶source
bloqade.gemini.common.validation.recursion.NoOpaqueCallValidation
Bases: ValidationPass
Reject calls made through one of the kernel's own parameters.
class NoOpaqueCallValidationCallGraph can only see statically resolved edges, so a call through a
value is a hole in it: hand a kernel in as a value and call it and the result
is a cycle no amount of graph walking will find, costing phi ** max_depth
in the address analysis once the branching factor reaches two. Resolving the
target instead would need the constant propagation that diverges on exactly
that input, so the shape is rejected rather than resolved.
Both a func.Call and a higher-order statement’s callable operand count:
ilist.Map and friends invoke their fn without being a func.Call.
Known gap. Matching the parameter object is bypassed by routing the
callable through anything at all before calling it — an if/else makes
it a block argument of a successor block, a list makes it a getitem
result — and neither is the parameter, so neither is caught. Rejecting every
unresolved call instead was tried and is not viable: after inlining, a
perfectly ordinary stdlib kernel calls a self value belonging to an inlined
region rather than to the method being scanned, so it is reported as opaque
and the physical pipeline stops compiling. Closing this properly needs
provenance for callable values, which is the analysis scoped in #927.
Every statically reachable method is scanned, not just the entry. Checking only the entry leaves the hang reachable through a callee: a Gemini kernel can statically invoke a kernel from another dialect group, which never ran this guard and may make an opaque call of its own.
methodname¶source
bloqade.gemini.common.validation.recursion.NoOpaqueCallValidation.name
methodrun¶source
bloqade.gemini.common.validation.recursion.NoOpaqueCallValidation.run
def run(method: ir.Method) -> tuple[Any, list[ir.ValidationError]]Parameters
| Name | Type | Description |
|---|---|---|
method | ir.Method |
Returns
tuple[Any, list[ir.ValidationError]]