pytc.tc._choose_tc_kernel_strategy

pytc.tc._choose_tc_kernel_strategy(device, u1, u3, *, fraction=0.15)[source]

Decide how TC kernels (K1 + K3) should be kept for tile consumption.

Returns (resident, panel_size):
  • (True, None) — K1 + K3 fit comfortably on device; keep them resident. Consumers call the streaming wrapper with panel_size=None which delegates to the existing JIT unchanged.

  • (False, int) — K1 + K3 would claim too large a share of the device budget, leaving no room for tile transients. Caller should keep the kernels on host; panel_size is the axis-1 slab width the consumer should stream in per call.

fraction is the per-device share (of probed free memory) above which we switch to streaming. 0.15 leaves >= 80 % of the budget for tile transients (K1_transient / scratch / D / phi), which matches the scratch profile observed empirically on A100-80G at n_fused ~25k.