elide big constants in onnx mlir dump
Validate Operations / validate-operations (push) Has been cancelled
Validate Operations / validate-operations (push) Has been cancelled
This commit is contained in:
@@ -294,7 +294,7 @@ def compile_reference(
|
||||
model_path: Path,
|
||||
work_dir: Path,
|
||||
steps: list[StepRecord],
|
||||
) -> tuple[Path, Path, Path]:
|
||||
) -> Path:
|
||||
raptor_dir = work_dir / "reference"
|
||||
runner_dir = work_dir / "runner"
|
||||
build_dir = runner_dir / "build"
|
||||
@@ -306,7 +306,8 @@ def compile_reference(
|
||||
|
||||
run_logged(
|
||||
"Reference Emit ONNX IR",
|
||||
[str(args.raptor_path), str(model_path), "-o", str(onnx_ir_base), "--EmitONNXIR"],
|
||||
[str(args.raptor_path), str(model_path), "-o", str(onnx_ir_base), "--EmitONNXIR",
|
||||
"--mlir-elide-elementsattrs-if-larger=16"],
|
||||
cwd=REPO,
|
||||
timeout_sec=args.timeout_seconds,
|
||||
steps=steps,
|
||||
@@ -319,7 +320,6 @@ def compile_reference(
|
||||
steps=steps,
|
||||
)
|
||||
network_so = runner_base.with_suffix(".so")
|
||||
network_mlir = onnx_ir_base.with_suffix(".onnx.mlir")
|
||||
|
||||
print_step("Generate Runner Source")
|
||||
gen_network_runner(model_path, network_so, args.onnx_include_dir, out=runner_dir / "runner.c", verbose=False)
|
||||
@@ -338,7 +338,7 @@ def compile_reference(
|
||||
timeout_sec=args.timeout_seconds,
|
||||
steps=steps,
|
||||
)
|
||||
return network_mlir, network_so, build_dir / "runner"
|
||||
return build_dir / "runner"
|
||||
|
||||
|
||||
def generate_reference_outputs(
|
||||
@@ -366,7 +366,7 @@ def generate_reference_outputs(
|
||||
|
||||
|
||||
def compile_raptor_target(
|
||||
model_mlir: Path,
|
||||
model_path: Path,
|
||||
out_dir: Path,
|
||||
hardware: dict[str, int],
|
||||
args: argparse.Namespace,
|
||||
@@ -375,7 +375,7 @@ def compile_raptor_target(
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
cmd = [
|
||||
str(args.raptor_path),
|
||||
str(model_mlir),
|
||||
str(model_path),
|
||||
"-o",
|
||||
str(out_dir / "model"),
|
||||
"--maccel=PIM",
|
||||
@@ -392,7 +392,7 @@ def compile_raptor_target(
|
||||
raptor_extra_args = ["--pim-emit-json", *args.raptor_extra_arg]
|
||||
try:
|
||||
timings = compile_with_raptor(
|
||||
model_mlir,
|
||||
model_path,
|
||||
args.raptor_path,
|
||||
out_dir / "model",
|
||||
hardware["crossbar_size"],
|
||||
@@ -1180,7 +1180,6 @@ def main():
|
||||
arrays_in_order: list[np.ndarray] = []
|
||||
runtime_inputs: list[np.ndarray] = []
|
||||
|
||||
network_mlir: Path | None = None
|
||||
runner_path: Path | None = None
|
||||
reference_dir: Path | None = None
|
||||
raptor_pim_dir: Path | None = None
|
||||
@@ -1205,7 +1204,6 @@ def main():
|
||||
if model_io is not None:
|
||||
inputs_desc, outputs_desc, arrays_in_order, runtime_inputs = model_io
|
||||
|
||||
expected_network_mlir = out_dir / "reference" / f"{model_path.stem}.onnx.mlir"
|
||||
expected_runner_path = out_dir / "runner" / "build" / "runner"
|
||||
|
||||
reference_compile = try_stage(
|
||||
@@ -1218,11 +1216,8 @@ def main():
|
||||
steps,
|
||||
)
|
||||
if reference_compile is not None:
|
||||
network_mlir, _, runner_path = reference_compile
|
||||
runner_path = reference_compile
|
||||
else:
|
||||
if expected_network_mlir.exists():
|
||||
network_mlir = expected_network_mlir
|
||||
print(f"\n[Continue] Reusing partial ONNX MLIR: {network_mlir}")
|
||||
if expected_runner_path.exists():
|
||||
runner_path = expected_runner_path
|
||||
print(f"\n[Continue] Reusing partial runner: {runner_path}")
|
||||
@@ -1249,12 +1244,12 @@ def main():
|
||||
"Reference outputs were skipped because the native runner or model inputs are not available.",
|
||||
)
|
||||
|
||||
if network_mlir is not None and network_mlir.exists() and hardware["core_count"] > 0:
|
||||
if model_path.exists() and hardware["core_count"] > 0:
|
||||
compiled_raptor = try_stage(
|
||||
failures,
|
||||
"Compile Raptor PIM",
|
||||
compile_raptor_target,
|
||||
network_mlir,
|
||||
model_path,
|
||||
out_dir / "raptor",
|
||||
hardware,
|
||||
args,
|
||||
@@ -1266,7 +1261,7 @@ def main():
|
||||
record_failure(
|
||||
failures,
|
||||
"Skip Raptor PIM compile",
|
||||
"Raptor PIM compile was skipped because the ONNX MLIR or hardware configuration is not available.",
|
||||
"Raptor PIM compile was skipped because the ONNX model or hardware configuration is not available.",
|
||||
)
|
||||
|
||||
if raptor_pim_dir is not None:
|
||||
|
||||
@@ -228,7 +228,8 @@ def compile_onnx_network(network_onnx_path, raptor_path, raptor_dir, runner_dir,
|
||||
stem = network_onnx_path.stem
|
||||
onnx_ir_base = raptor_dir / stem
|
||||
runner_base = runner_dir / stem
|
||||
run_command([raptor_path, network_onnx_path, "-o", onnx_ir_base, "--EmitONNXIR"],
|
||||
run_command([raptor_path, network_onnx_path, "-o", onnx_ir_base, "--EmitONNXIR",
|
||||
"--mlir-elide-elementsattrs-if-larger=16"],
|
||||
reporter=reporter, timeout_sec=timeout_sec)
|
||||
run_command([raptor_path, network_onnx_path, "-o", runner_base], reporter=reporter, timeout_sec=timeout_sec)
|
||||
network_so_path = runner_base.with_suffix(".so")
|
||||
|
||||
Reference in New Issue
Block a user