Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to new IREE package names and versions. #258

Merged
merged 9 commits into from
Nov 9, 2024

Conversation

ScottTodd
Copy link
Member

IREE is renaming its Python packages from iree-compiler and iree-runtime to iree-base-compiler and iree-base-runtime, in order to switch to a new versioning scheme: iree-org/iree#18938. This switches to using the new package names and versions and cleans up some related documentation along the way.

Note: the new packages are not yet built and published, hence this is a draft PR. Once packages are published we can rebase, test this, and then proceed.

iree-requirements-ci.txt Outdated Show resolved Hide resolved
@ScottTodd ScottTodd marked this pull request as ready for review November 8, 2024 18:40
@ScottTodd
Copy link
Member Author

Synced after publishing IREE packages to PyPI:

I'll merge this after workflows pass and then push a 2.9.0 release of this project too.

@ScottTodd
Copy link
Member Author

CI unit tests are very broken - stalling without useful logs. Trying to debug through, but I'm only making very slow progress.

Commit range from IREE: iree-org/iree@candidate-20241104.1068...iree-2.9.0rc20241108

@ScottTodd
Copy link
Member Author

Bisected one test failure to iree-org/iree@iree-2.9.0rc20241107...iree-2.9.0rc20241108 (only three commits in there)

From this repo's main branch (cb19c83)

python3.11 -m venv --prompt iree-turbine bisect.venv
source bisect.venv/bin/activate
pip install -r pytorch-cpu-requirements.txt
pip install -r requirements.txt -e .
python -m pip uninstall iree-compiler iree-runtime
python -m pip install  \
  --find-links https://iree.dev/pip-release-links.html \
  --upgrade \
  iree-base-compiler==2.9.0rc20241108 \
  iree-base-runtime==2.9.0rc20241108
pytest -k globals_test

test logs:

================================================= test session starts ==================================================
platform linux -- Python 3.11.10, pytest-8.0.0, pluggy-1.5.0
rootdir: /home/nod/dev/projects/iree-turbine
configfile: setup.cfg
testpaths: ./tests
plugins: xdist-3.5.0
collected 578 items / 557 deselected / 21 selected                                                                     

tests/aot/globals_test.py ...................FF                                                                  [100%]

======================================================= FAILURES =======================================================
_____________________________________________ BufferTest.testMutableBuffer _____________________________________________

self = <globals_test.BufferTest testMethod=testMutableBuffer>

    def testMutableBuffer(self):
        max_size = 10
        simple_cache = SimpleCache(max_size)
    
        input_pos = torch.tensor([2, 5, 7])
        values = torch.tensor([1.0, 2.0, 3.0])
        simple_cache(input_pos, values)
        exported_fx_graph = torch.export.export(simple_cache, args=(input_pos, values))
>       exported_programm = export(exported_fx_graph)

tests/aot/globals_test.py:467: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
iree/turbine/aot/exporter.py:351: in export
    cm = TransformedModule(context=context, import_to="import")
iree/turbine/aot/compiled_module.py:708: in __new__
    info.shadow_dict[key] = import_exported_program(
iree/turbine/aot/support/procedural/exported_program.py:190: in import_exported_program
    entry_func_op = fx_importer.import_program(
bisect.venv/lib/python3.11/site-packages/iree/compiler/extras/fx_importer.py:802: in import_program
    node_importer.import_nodes(
bisect.venv/lib/python3.11/site-packages/iree/compiler/extras/fx_importer.py:1460: in import_nodes
    self._import_torch_op_overload(loc, node)
bisect.venv/lib/python3.11/site-packages/iree/compiler/extras/fx_importer.py:1696: in _import_torch_op_overload
    self.bind_node_value(node, value, i)
bisect.venv/lib/python3.11/site-packages/iree/compiler/extras/fx_importer.py:1301: in bind_node_value
    producer_callback(value)
bisect.venv/lib/python3.11/site-packages/iree/compiler/extras/fx_importer.py:1410: in on_produced
    self.fx_importer._hooks.store_produced_value(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <iree.turbine.aot.support.procedural.exported_program._Hooks object at 0x75f5e52af2d0>
gni = <iree.compiler.extras.fx_importer.GraphNodeImporter object at 0x75f5e43a7df0>
py_value = tensor([0., 0., 1., 0., 0., 2., 0., 3., 0., 0.])
produced_ir_value = <iree.compiler._mlir_libs._mlir.ir.OpResult object at 0x75f5e4d83570>
info = InputInfo(program=<torch.export.exported_program.ExportedProgram object at 0x75f5e4d835d0>, input_spec=InputSpec(kind=...node=b_cache, ir_type=Type(!torch.vtensor<[10],f32>), mutable_producer_node_name=None, store_producer_node='index_put')

    def store_produced_value(
        self,
        gni: GraphNodeImporter,
        py_value: Any,
        produced_ir_value: Any,
        info: InputInfo,
    ):
        module_builder = self.module_builder
        # See if we know about it.
        mapping = module_builder.global_ref_tracker.track(py_value)
        if mapping.is_empty:
            raise ValueError(f"Cannot store value to unmapped global for: {info}")
        logger.debug("Resolved  global for store %r", mapping)
        materialized_global: MaterializedGlobal = mapping.value  # type: ignore
>       assert isinstance(materialized_global.global_op, util_d.GlobalOp)
E       AssertionError

iree/turbine/aot/support/procedural/exported_program.py:255: AssertionError
______________________________________ BufferTest.testReadWriteReadMutableBuffer _______________________________________

self = <globals_test.BufferTest testMethod=testReadWriteReadMutableBuffer>

    def testReadWriteReadMutableBuffer(self):
        max_size = 10
        simple_cache = ReadWriteReadCache(max_size)
    
        input_pos = torch.tensor([2, 5, 7])
        values = torch.tensor([1.0, 2.0, 3.0])
        simple_cache(input_pos, values)
        exported_fx_graph = torch.export.export(simple_cache, args=(input_pos, values))
>       exported_programm = export(exported_fx_graph)

tests/aot/globals_test.py:482: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
iree/turbine/aot/exporter.py:351: in export
    cm = TransformedModule(context=context, import_to="import")
iree/turbine/aot/compiled_module.py:708: in __new__
    info.shadow_dict[key] = import_exported_program(
iree/turbine/aot/support/procedural/exported_program.py:190: in import_exported_program
    entry_func_op = fx_importer.import_program(
bisect.venv/lib/python3.11/site-packages/iree/compiler/extras/fx_importer.py:802: in import_program
    node_importer.import_nodes(
bisect.venv/lib/python3.11/site-packages/iree/compiler/extras/fx_importer.py:1460: in import_nodes
    self._import_torch_op_overload(loc, node)
bisect.venv/lib/python3.11/site-packages/iree/compiler/extras/fx_importer.py:1696: in _import_torch_op_overload
    self.bind_node_value(node, value, i)
bisect.venv/lib/python3.11/site-packages/iree/compiler/extras/fx_importer.py:1301: in bind_node_value
    producer_callback(value)
bisect.venv/lib/python3.11/site-packages/iree/compiler/extras/fx_importer.py:1410: in on_produced
    self.fx_importer._hooks.store_produced_value(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <iree.turbine.aot.support.procedural.exported_program._Hooks object at 0x75f5e394a350>
gni = <iree.compiler.extras.fx_importer.GraphNodeImporter object at 0x75f5e3746e30>
py_value = tensor([0., 0., 1., 0., 0., 2., 0., 3., 0., 0.])
produced_ir_value = <iree.compiler._mlir_libs._mlir.ir.OpResult object at 0x75f5e431a670>
info = InputInfo(program=<torch.export.exported_program.ExportedProgram object at 0x75f5e4da1c90>, input_spec=InputSpec(kind=...node=b_cache, ir_type=Type(!torch.vtensor<[10],f32>), mutable_producer_node_name=None, store_producer_node='index_put')

    def store_produced_value(
        self,
        gni: GraphNodeImporter,
        py_value: Any,
        produced_ir_value: Any,
        info: InputInfo,
    ):
        module_builder = self.module_builder
        # See if we know about it.
        mapping = module_builder.global_ref_tracker.track(py_value)
        if mapping.is_empty:
            raise ValueError(f"Cannot store value to unmapped global for: {info}")
        logger.debug("Resolved  global for store %r", mapping)
        materialized_global: MaterializedGlobal = mapping.value  # type: ignore
>       assert isinstance(materialized_global.global_op, util_d.GlobalOp)
E       AssertionError

iree/turbine/aot/support/procedural/exported_program.py:255: AssertionError
=================================================== warnings summary ===================================================
tests/runtime/device_test.py:134
  /home/nod/dev/projects/iree-turbine/tests/runtime/device_test.py:134: UserWarning: Not testing CUDA interop (device not available)
    warnings.warn("Not testing CUDA interop (device not available)")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=============================================== short test summary info ================================================
FAILED tests/aot/globals_test.py::BufferTest::testMutableBuffer - AssertionError
FAILED tests/aot/globals_test.py::BufferTest::testReadWriteReadMutableBuffer - AssertionError

@ScottTodd
Copy link
Member Author

The prior release from the middle of yesterday (https://github.com/iree-org/iree/releases/tag/iree-2.9.0rc20241108) passes tests/aot/globals_test.py but hangs on tests/dynamo/tensor_test.py. The following build (https://github.com/iree-org/iree/releases/tag/iree-2.9.0rc20241108) is what I promoted to PyPI.

ScottTodd added a commit that referenced this pull request Nov 8, 2024
I'm seeing all sorts of test failures on
#258 when I try to roll up
to the latest stable release with new package names and versions
(`iree-base-compiler<=2.9.0`). Trying an incremental update while
debugging that.
@ScottTodd
Copy link
Member Author

Down to three test failures:

 =========================== short test summary info ============================
FAILED tests/aot/globals_test.py::BufferTest::testMutableBuffer - AssertionError
FAILED tests/aot/globals_test.py::BufferTest::testReadWriteReadMutableBuffer - AssertionError
FAILED tests/aot/compiled_exported_program_test.py::TorchExportTests::testBuffersAsGlobals - AssertionError
====== 3 failed, 287 passed, 279 skipped, 9 xfailed, 8 warnings in 41.15s ======

May be able to XFAIL those and proceed. Not sure if local changes are needed or if something regressed in IREE or MLIR.

@ScottTodd ScottTodd merged commit 4a3f8c9 into main Nov 9, 2024
7 checks passed
@ScottTodd ScottTodd deleted the shared/iree-packages-rename branch November 9, 2024 00:27
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.

2 participants