Skip to content

Target generator dsl

Starlark-hosted target generator (Plan B of #597).

Loads a .star file via the Rust TargetPolicyRunner and adapts it to :class:TargetGeneratorABC so it can be injected at PhysicalPlacementStrategy(target_generator=...).

Validation (qid coverage, location-group validity, CZ-blockade pair invariant) is performed by the Rust kernel before the candidates ever reach Python; if the policy returns a malformed candidate, generate raises :class:ValueError from the underlying runner.

TargetGeneratorDSL dataclass

TargetGeneratorDSL(
    policy_path: str,
    policy_params: Mapping[str, object] | None = None,
)

Bases: TargetGeneratorABC


              flowchart TD
              bloqade.lanes.heuristics.physical.target_generator_dsl.TargetGeneratorDSL[TargetGeneratorDSL]
              bloqade.lanes.heuristics.physical.target_generator.TargetGeneratorABC[TargetGeneratorABC]

                              bloqade.lanes.heuristics.physical.target_generator.TargetGeneratorABC --> bloqade.lanes.heuristics.physical.target_generator_dsl.TargetGeneratorDSL
                


              click bloqade.lanes.heuristics.physical.target_generator_dsl.TargetGeneratorDSL href "" "bloqade.lanes.heuristics.physical.target_generator_dsl.TargetGeneratorDSL"
              click bloqade.lanes.heuristics.physical.target_generator.TargetGeneratorABC href "" "bloqade.lanes.heuristics.physical.target_generator.TargetGeneratorABC"
            

Target generator backed by a Starlark .star policy file.

The runner is created lazily on the first generate(ctx) call so the arch spec it indexes against matches the placement strategy's spec. Subsequent calls reuse the cached runner unless the arch spec instance changes (e.g. between placements over different architectures).