"""Fill a Triton cache dir with the kernel's variants on a builder (no GPU).

A card box then finds a JIT launch's binary in the cache and compiles nothing.
"""

import os
import sys

sys.path.insert(0, "/w")
os.environ["TRITON_CACHE_DIR"] = sys.argv[1]

import triton
from triton.backends.compiler import GPUTarget

from arbi_serve.kernels import add_rmsnorm_f16 as fused

target = GPUTarget(backend="cuda", arch=89, warp_size=32)
for variant in fused.variants():
    triton.compile(fused.aot_source(*variant), target=target, options=dict(fused.AOT_OPTIONS))
print("seeded", len(fused.variants()))
