Skip to content

Core ML llama export silently produces no etrecord #22301

Description

@shoumikhin

What

A Core ML llama export that asks for an etrecord gets no file and no warning.

_to_edge_and_lower_llama_coreml sets the etrecord flag on the builder, but nothing afterwards asks
the program manager for the record or saves it, and the save step writes the model file and stops.

Measured on the same tiny model, changing only which lowering arm runs, with
debug.generate_etrecord true:

arm files produced
generic ['etrecord.bin', 'llama3.pte']
Core ML ['llama3.pte']

No file, no warning. It also still pays for a copy.deepcopy of the whole edge program, which is
then dropped (exir/_program.py attaches the record via deepcopy).

The path Core ML took before #21969 wrote the file, so for anyone using that flag this is a step
back rather than a pre-existing gap.

Related

_to_edge_and_lower_llama_xnnpack has the same gap with a TODO next to it. Worth copying that TODO
onto the Core ML helper so the next reader sees it, whichever way this is fixed.

Caveat on my measurement: the Core ML run substituted an XNNPACK partitioner, since real Core ML
lowering needs macOS. The etrecord plumbing exercised is the real one, but the Core ML backend was
not.

Found while reviewing #22298.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions