Skip to content

feat(coreai_utils): universal assets with deferred weight transforms … - #129

Closed
wangpengmit wants to merge 1 commit into
apple:mainfrom
wangpengmit:dev/wangpengmit/uasset/data-free/aot/1
Closed

wangpengmit wants to merge 1 commit into
apple:mainfrom
wangpengmit:dev/wangpengmit/uasset/data-free/aot/1

Conversation

@wangpengmit

@wangpengmit wangpengmit commented Oct 2, 2026 •

Copy link
Copy Markdown

…(prototype)

Universal Asset prototype 2a, not for merge.

make_universal_asset(program, schemes, out) runs each data-free compression scheme (a coreai-opt function and its kwargs) on a copy of the model and saves that copy as the scheme's direct twin. It then replaces every weight constant that the compression calculated with a udml.placeholder "uasset.weight_transform" that reads the fp16 source, at the same position and location, and records the kernel and its resolved parameters in weight_transforms/<scheme>.json. The scheme graphs (@main__<scheme>) and the fp16 @main go into one universal.aimodel with one copy of the weights. CoreAI's coreai-materialize-weight-transforms pass computes the placeholders at JIT compile time.

Testing: Added tests/coreai_utils/test_universal.py (one copy of each weight, a JSON entry for each placeholder, and refilling the placeholders with coreai-opt's values gives the direct twin exactly, for quantize, palettize and sparsify schemes on fp16 and fp32 weights).

…(prototype)

Universal Asset prototype 2a, not for merge.

`make_universal_asset(program, schemes, out)` runs each data-free
compression scheme (a coreai-opt function and its kwargs) on a copy of the
model and saves that copy as the scheme's direct twin. It then replaces
every weight constant that the compression calculated with a
`udml.placeholder "uasset.weight_transform"` that reads the fp16 source, at
the same position and location, and records the kernel and its resolved
parameters in `weight_transforms/<scheme>.json`. The scheme graphs
(`@main__<scheme>`) and the fp16 `@main` go into one `universal.aimodel`
with one copy of the weights. CoreAI's `coreai-materialize-weight-transforms`
pass computes the placeholders at JIT compile time.

Testing: Added tests/coreai_utils/test_universal.py (one copy of each
weight, a JSON entry for each placeholder, and refilling the placeholders
with coreai-opt's values gives the direct twin exactly, for quantize,
palettize and sparsify schemes on fp16 and fp32 weights).
@wangpengmit
wangpengmit force-pushed the dev/wangpengmit/uasset/data-free/aot/1 branch from c7d90e7 to f3a5410 Compare October 8, 2026 21:36
@wangpengmit wangpengmit closed this Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant