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

Rework HAL CTS to use the C API #3934

Closed
benvanik opened this issue Nov 20, 2020 · 2 comments
Closed

Rework HAL CTS to use the C API #3934

benvanik opened this issue Nov 20, 2020 · 2 comments
Assignees
Labels
hal/vulkan Runtime Vulkan GPU HAL backend runtime Relating to the IREE runtime library

Comments

@benvanik
Copy link
Collaborator

benvanik commented Nov 20, 2020

It currently is using C++ types directly, which reduces its usefulness with respect to testing the HAL and documenting its usage. It's also blocking porting portions of the HAL to C which is required to allow external user-provided HAL backends.

This isn't urgent but if left too long the CTS will likely need to be deleted until one using the C API can be written (it's not providing enough value in its current form relative to unblocking out-of-tree HAL drivers). A CTS against the C API would be extremely valuable for developers of out-of-tree drivers (as well as for ensuring good coverage of the C API for us), so it's definitely good to get a plan in place to fix it up.

@benvanik benvanik added runtime Relating to the IREE runtime library hal/vulkan Runtime Vulkan GPU HAL backend labels Nov 20, 2020
@benvanik benvanik added this to the 2020Q4 Core milestone Nov 20, 2020
@benvanik
Copy link
Collaborator Author

As we are likely to be making more changes to the HAL during the Q1 having a CTS (or using it as an excuse to flesh one out) would be useful to ensuring that we are working correctly across metal and vulkan (and webgpu and such).

@benvanik benvanik removed this from the 2020Q4 Core milestone Nov 22, 2020
benvanik added a commit that referenced this issue Dec 24, 2020
benvanik added a commit that referenced this issue Dec 30, 2020
benvanik added a commit that referenced this issue Jan 4, 2021
benvanik added a commit that referenced this issue Jan 5, 2021
benvanik added a commit that referenced this issue Jan 5, 2021
benvanik added a commit that referenced this issue Jan 5, 2021
benvanik added a commit that referenced this issue Jan 5, 2021
benvanik added a commit that referenced this issue Jan 5, 2021
@ScottTodd
Copy link
Member

It would also be nice to rework the gtest setup so that out of tree drivers can run against the same set of tests, or the list of drivers to test against could be controlled more easily. The current

INSTANTIATE_TEST_SUITE_P(
    AllDrivers, AllocatorTest,
    ::testing::ValuesIn(testing::EnumerateAvailableDrivers()),
    GenerateTestName());

style setup is pretty constrained in how it runs and the output isn't as useful as it could be when different drivers are mixed together test case by test case.

ScottTodd added a commit that referenced this issue Jan 19, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik added a commit that referenced this issue Jan 21, 2021
benvanik pushed a commit that referenced this issue Jan 21, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik pushed a commit that referenced this issue Jan 21, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik pushed a commit that referenced this issue Jan 21, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik pushed a commit that referenced this issue Jan 22, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik added a commit that referenced this issue Jan 22, 2021
benvanik pushed a commit that referenced this issue Jan 22, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik pushed a commit that referenced this issue Jan 22, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik pushed a commit that referenced this issue Jan 22, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik added a commit that referenced this issue Jan 22, 2021
benvanik pushed a commit that referenced this issue Jan 22, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik pushed a commit that referenced this issue Jan 23, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik pushed a commit that referenced this issue Jan 24, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik pushed a commit that referenced this issue Jan 24, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik pushed a commit that referenced this issue Jan 24, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
benvanik added a commit that referenced this issue Jan 26, 2021
benvanik pushed a commit that referenced this issue Jan 26, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
ScottTodd pushed a commit to ScottTodd/iree that referenced this issue Jan 26, 2021
Removing unused HAL files/functions/types.

Removing last use of HAL C++ from the HAL VM module.

Swapping many C++ HAL types/enums for C ones.

Removing iree/base/bitfield.h.
The formatting functionality will reappear in iree_string_builder.

Removing iree/hal/cts/ for now until it can be ported to C.
Issue iree-org#3934 is tracking this.

Moving HAL C++ types to iree/hal/cc/.

Removing C++ command buffer validation as it'll be moved into C.

Porting the HAL C++ API to C.
Unfortunately the string handling code is still very dependent on abseil,
but everything else is now just plain C.

Fixing quoting on cmake variables that *must* be quoted. (iree-org#4404)

Removing unused iree/hal/testing/ mock types.

Adding a new arena type with a shared thread-safe block pool.
This will be used to provide storage for command buffers and other
builder types (submissions/etc) in the local HAL backend.

Fixing tracing macro errors with the latest VC++.

Got a new error emitted:
`error C4576: a parenthesized type followed by an initializer
list is a non-standard explicit type conversion syntax`

Unfortunately C99 supports paren-init and not non-paren-init and
C++ supports the opposite so this error is dumb. Oh well.

Porting a majority of Vulkan/Metal to C.

Removing Metal backend until it can be replaced.
This commit can be used to revive the configuration for the driver
and view a partially-ported version of it. The actual implementation
will need to be rebased onto the C type system and written in
Objective C. Note that the compiler backend has not been removed - we
can use that for verifying metal shader output.

Issue iree-org#4370 tracks reviving this.

Removing iree/base/time.h now that no C++ remains using it.

Windows ptr atomics fix (needs test coverage, obviously).

Ensure wait handles are zero-initialized.

Removing unused status results.

Adding support for cleaning up tasks when retired/discarded.

Making call and dispatch task closures independent types.

Adding batch task submission enqueuing.

Fixing executables with multiple pipelines in Vulkan.

Disabling executable linking until it can be fixed iree-org#4536.

Revive the HAL CTS using the C API. (iree-org#4498)

Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes iree-org#3934, part of iree-org#4369.

Allowing iree_task_barrier_t to be initialized in two steps.
This is required when incrementally building the barrier: you want to
insert the barrier into the task DAG prior to knowing what the dependent
tasks are.

Improving `iree_task_post_batch_select_worker`.
With the way command buffers are issued today it tended to bias toward
only dispatching on the current worker and - even if worked around -
would bias towards idle workers even after the batch is queuing work on
them. This more evenly distributes work when many tasks are dispatched
within the same batch.

Working around crap _mktemp behavior.
It only generates 26 unique names per thread o_o

Adding a new iree/hal/local/ path as the local CPU driver.
This subsumes the existing iree/hal/host/ and will allow us to share the
same device for all local execution - including mixing and matching
executables in different forms (AOT, vmla, JIT, etc) within the same
device. It also adds the (initial, unoptimized) task-system based
command buffer and semaphore implementations.

Porting both the dylib and vmla drivers to use iree/hal/local.
Both entire drivers are now just loader implementations and then shims
that match the existing registration. In the future there will just be
--driver=local and dylib/vmla will just be compiler registrations like
HAL driver registrations currently are.

Removing iree/hal/host/ now that it is unused.

Moving VMLA VM module to iree/modules/vmla/.

Fixing temp file path cleanup. Can't wait to remove this code.

Making IREE_EXPECT_OK/IREE_ASSERT_OK print better messages.

Removing unused line to remove warning.

Tweaking iree_atomic_* macros to better check types and adding a test.

Fixing a type typo in the python bindings.

Fixing third_party/half bazel-to-cmake mapping.

Fixing a race where threads start prior to their handle being assigned.

Treating push constants offset/length as bytes in the API.
IR still needs a fixup, but is fine for now.

Making iree_status_t a non-void type to get better warnings on misuse.

Force mapping on hal.allocator.wrap.byte_buffer (today).

Cleanup of compile-time detection of sanitizers to enable TSAN/MSAN.
Also adds --config=tsan and --config=msan to iree.bazelrc.

Making threads join on shutdown (for sanity).
Doesn't seem to change anything but there's not really a reason to
detach and I'd rather never have to think about this code again.

Fixing push constants not being included in executable layout caching.
This would cause all kind of badness when multiple executables shared
the same hal.interface bindings but had differing push constants.

Adding iree_task_pool_t tests.

Adding iree_task_queue_t tests.

Adding iree_task_scope_t tests.

Adding iree_task_list_discard test.

Adding iree_task_topology_t tests and simplifying allocation.
The max size on the stack is 3KB, which is fine for something transient
like this that is only used for construction of the executor.

Removing HAL backend implementations of fill/read/write/copy.
They were all implemented using mapping anyway and this way we only have
that code once and make the restriction that buffers be mappable part of
their usage uniformly.

Better error status when drivers are not registered.

Split iree/tools/test/simple.mlir as it was a PITA all as one.

Fix Vulkan GUI sample after HAL C changes. (iree-org#4603)

More fixes after HAL C changes. (iree-org#4604)

* Use `IREE_RESTRICT` for older MSVC versions.
* Update iree-run-module-vulkan-gui-main.cc
* Include <atomic> for std::atomic use in GetTempFile.

Tested CMake build of `all` (vmla+vulkan only) on my Windows machine, with samples and Vulkan enabled.

Properly handling nop tasks in the task system.

Adding tests for the various iree_task_t types.

Temporarily disabling failing task system wait test.
This case is not yet exercised from our code but I'll be fixing it ASAP
anyway.
benvanik added a commit that referenced this issue Jan 27, 2021
benvanik pushed a commit that referenced this issue Jan 27, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
ScottTodd pushed a commit to ScottTodd/iree that referenced this issue Jan 27, 2021
Removing unused HAL files/functions/types.

Removing last use of HAL C++ from the HAL VM module.

Swapping many C++ HAL types/enums for C ones.

Removing iree/base/bitfield.h.
The formatting functionality will reappear in iree_string_builder.

Removing iree/hal/cts/ for now until it can be ported to C.
Issue iree-org#3934 is tracking this.

Moving HAL C++ types to iree/hal/cc/.

Removing C++ command buffer validation as it'll be moved into C.

Porting the HAL C++ API to C.
Unfortunately the string handling code is still very dependent on abseil,
but everything else is now just plain C.

Fixing quoting on cmake variables that *must* be quoted. (iree-org#4404)

Removing unused iree/hal/testing/ mock types.

Adding a new arena type with a shared thread-safe block pool.
This will be used to provide storage for command buffers and other
builder types (submissions/etc) in the local HAL backend.

Fixing tracing macro errors with the latest VC++.

Got a new error emitted:
`error C4576: a parenthesized type followed by an initializer
list is a non-standard explicit type conversion syntax`

Unfortunately C99 supports paren-init and not non-paren-init and
C++ supports the opposite so this error is dumb. Oh well.

Porting a majority of Vulkan/Metal to C.

Removing Metal backend until it can be replaced.
This commit can be used to revive the configuration for the driver
and view a partially-ported version of it. The actual implementation
will need to be rebased onto the C type system and written in
Objective C. Note that the compiler backend has not been removed - we
can use that for verifying metal shader output.

Issue iree-org#4370 tracks reviving this.

Removing iree/base/time.h now that no C++ remains using it.

Windows ptr atomics fix (needs test coverage, obviously).

Ensure wait handles are zero-initialized.

Removing unused status results.

Adding support for cleaning up tasks when retired/discarded.

Making call and dispatch task closures independent types.

Adding batch task submission enqueuing.

Fixing executables with multiple pipelines in Vulkan.

Disabling executable linking until it can be fixed iree-org#4536.

Revive the HAL CTS using the C API. (iree-org#4498)

Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes iree-org#3934, part of iree-org#4369.

Allowing iree_task_barrier_t to be initialized in two steps.
This is required when incrementally building the barrier: you want to
insert the barrier into the task DAG prior to knowing what the dependent
tasks are.

Improving `iree_task_post_batch_select_worker`.
With the way command buffers are issued today it tended to bias toward
only dispatching on the current worker and - even if worked around -
would bias towards idle workers even after the batch is queuing work on
them. This more evenly distributes work when many tasks are dispatched
within the same batch.

Working around crap _mktemp behavior.
It only generates 26 unique names per thread o_o

Adding a new iree/hal/local/ path as the local CPU driver.
This subsumes the existing iree/hal/host/ and will allow us to share the
same device for all local execution - including mixing and matching
executables in different forms (AOT, vmla, JIT, etc) within the same
device. It also adds the (initial, unoptimized) task-system based
command buffer and semaphore implementations.

Porting both the dylib and vmla drivers to use iree/hal/local.
Both entire drivers are now just loader implementations and then shims
that match the existing registration. In the future there will just be
--driver=local and dylib/vmla will just be compiler registrations like
HAL driver registrations currently are.

Removing iree/hal/host/ now that it is unused.

Moving VMLA VM module to iree/modules/vmla/.

Fixing temp file path cleanup. Can't wait to remove this code.

Making IREE_EXPECT_OK/IREE_ASSERT_OK print better messages.

Removing unused line to remove warning.

Tweaking iree_atomic_* macros to better check types and adding a test.

Fixing a type typo in the python bindings.

Fixing third_party/half bazel-to-cmake mapping.

Fixing a race where threads start prior to their handle being assigned.

Treating push constants offset/length as bytes in the API.
IR still needs a fixup, but is fine for now.

Making iree_status_t a non-void type to get better warnings on misuse.

Force mapping on hal.allocator.wrap.byte_buffer (today).

Cleanup of compile-time detection of sanitizers to enable TSAN/MSAN.
Also adds --config=tsan and --config=msan to iree.bazelrc.

Making threads join on shutdown (for sanity).
Doesn't seem to change anything but there's not really a reason to
detach and I'd rather never have to think about this code again.

Fixing push constants not being included in executable layout caching.
This would cause all kind of badness when multiple executables shared
the same hal.interface bindings but had differing push constants.

Adding iree_task_pool_t tests.

Adding iree_task_queue_t tests.

Adding iree_task_scope_t tests.

Adding iree_task_list_discard test.

Adding iree_task_topology_t tests and simplifying allocation.
The max size on the stack is 3KB, which is fine for something transient
like this that is only used for construction of the executor.

Removing HAL backend implementations of fill/read/write/copy.
They were all implemented using mapping anyway and this way we only have
that code once and make the restriction that buffers be mappable part of
their usage uniformly.

Better error status when drivers are not registered.

Split iree/tools/test/simple.mlir as it was a PITA all as one.

Fix Vulkan GUI sample after HAL C changes. (iree-org#4603)

More fixes after HAL C changes. (iree-org#4604)

* Use `IREE_RESTRICT` for older MSVC versions.
* Update iree-run-module-vulkan-gui-main.cc
* Include <atomic> for std::atomic use in GetTempFile.

Tested CMake build of `all` (vmla+vulkan only) on my Windows machine, with samples and Vulkan enabled.

Properly handling nop tasks in the task system.

Adding tests for the various iree_task_t types.

Temporarily disabling failing task system wait test.
This case is not yet exercised from our code but I'll be fixing it ASAP
anyway.

Fixing off-by-one in minilcg128.
ScottTodd pushed a commit to ScottTodd/iree that referenced this issue Jan 27, 2021
Removing unused HAL files/functions/types.

Removing last use of HAL C++ from the HAL VM module.

Swapping many C++ HAL types/enums for C ones.

Removing iree/base/bitfield.h.
The formatting functionality will reappear in iree_string_builder.

Removing iree/hal/cts/ for now until it can be ported to C.
Issue iree-org#3934 is tracking this.

Moving HAL C++ types to iree/hal/cc/.

Removing C++ command buffer validation as it'll be moved into C.

Porting the HAL C++ API to C.
Unfortunately the string handling code is still very dependent on abseil,
but everything else is now just plain C.

Fixing quoting on cmake variables that *must* be quoted. (iree-org#4404)

Removing unused iree/hal/testing/ mock types.

Adding a new arena type with a shared thread-safe block pool.
This will be used to provide storage for command buffers and other
builder types (submissions/etc) in the local HAL backend.

Fixing tracing macro errors with the latest VC++.

Got a new error emitted:
`error C4576: a parenthesized type followed by an initializer
list is a non-standard explicit type conversion syntax`

Unfortunately C99 supports paren-init and not non-paren-init and
C++ supports the opposite so this error is dumb. Oh well.

Porting a majority of Vulkan/Metal to C.

Removing Metal backend until it can be replaced.
This commit can be used to revive the configuration for the driver
and view a partially-ported version of it. The actual implementation
will need to be rebased onto the C type system and written in
Objective C. Note that the compiler backend has not been removed - we
can use that for verifying metal shader output.

Issue iree-org#4370 tracks reviving this.

Removing iree/base/time.h now that no C++ remains using it.

Windows ptr atomics fix (needs test coverage, obviously).

Ensure wait handles are zero-initialized.

Removing unused status results.

Adding support for cleaning up tasks when retired/discarded.

Making call and dispatch task closures independent types.

Adding batch task submission enqueuing.

Fixing executables with multiple pipelines in Vulkan.

Disabling executable linking until it can be fixed iree-org#4536.

Revive the HAL CTS using the C API. (iree-org#4498)

Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes iree-org#3934, part of iree-org#4369.

Allowing iree_task_barrier_t to be initialized in two steps.
This is required when incrementally building the barrier: you want to
insert the barrier into the task DAG prior to knowing what the dependent
tasks are.

Improving `iree_task_post_batch_select_worker`.
With the way command buffers are issued today it tended to bias toward
only dispatching on the current worker and - even if worked around -
would bias towards idle workers even after the batch is queuing work on
them. This more evenly distributes work when many tasks are dispatched
within the same batch.

Working around crap _mktemp behavior.
It only generates 26 unique names per thread o_o

Adding a new iree/hal/local/ path as the local CPU driver.
This subsumes the existing iree/hal/host/ and will allow us to share the
same device for all local execution - including mixing and matching
executables in different forms (AOT, vmla, JIT, etc) within the same
device. It also adds the (initial, unoptimized) task-system based
command buffer and semaphore implementations.

Porting both the dylib and vmla drivers to use iree/hal/local.
Both entire drivers are now just loader implementations and then shims
that match the existing registration. In the future there will just be
--driver=local and dylib/vmla will just be compiler registrations like
HAL driver registrations currently are.

Removing iree/hal/host/ now that it is unused.

Moving VMLA VM module to iree/modules/vmla/.

Fixing temp file path cleanup. Can't wait to remove this code.

Making IREE_EXPECT_OK/IREE_ASSERT_OK print better messages.

Removing unused line to remove warning.

Tweaking iree_atomic_* macros to better check types and adding a test.

Fixing a type typo in the python bindings.

Fixing third_party/half bazel-to-cmake mapping.

Fixing a race where threads start prior to their handle being assigned.

Treating push constants offset/length as bytes in the API.
IR still needs a fixup, but is fine for now.

Making iree_status_t a non-void type to get better warnings on misuse.

Force mapping on hal.allocator.wrap.byte_buffer (today).

Cleanup of compile-time detection of sanitizers to enable TSAN/MSAN.
Also adds --config=tsan and --config=msan to iree.bazelrc.

Making threads join on shutdown (for sanity).
Doesn't seem to change anything but there's not really a reason to
detach and I'd rather never have to think about this code again.

Fixing push constants not being included in executable layout caching.
This would cause all kind of badness when multiple executables shared
the same hal.interface bindings but had differing push constants.

Adding iree_task_pool_t tests.

Adding iree_task_queue_t tests.

Adding iree_task_scope_t tests.

Adding iree_task_list_discard test.

Adding iree_task_topology_t tests and simplifying allocation.
The max size on the stack is 3KB, which is fine for something transient
like this that is only used for construction of the executor.

Removing HAL backend implementations of fill/read/write/copy.
They were all implemented using mapping anyway and this way we only have
that code once and make the restriction that buffers be mappable part of
their usage uniformly.

Better error status when drivers are not registered.

Split iree/tools/test/simple.mlir as it was a PITA all as one.

Fix Vulkan GUI sample after HAL C changes. (iree-org#4603)

More fixes after HAL C changes. (iree-org#4604)

* Use `IREE_RESTRICT` for older MSVC versions.
* Update iree-run-module-vulkan-gui-main.cc
* Include <atomic> for std::atomic use in GetTempFile.

Tested CMake build of `all` (vmla+vulkan only) on my Windows machine, with samples and Vulkan enabled.

Properly handling nop tasks in the task system.

Adding tests for the various iree_task_t types.

Temporarily disabling failing task system wait test.
This case is not yet exercised from our code but I'll be fixing it ASAP
anyway.

Fixing off-by-one in minilcg128.

Fixing scope name length truncation.

Fixing ubsan-flagged potential undefined shift right behavior.

Android build fixes for HAL rewrite branch. (iree-org#4622)

Unfortunately not caught by any of our open source builds.

---

```
typedef size_t iree_host_size_t;
typedef uint64_t iree_device_size_t;
```

`iree_device_size_t` should use `% " PRIu64 "` instead of `%zu`

---

`ppoll` is available since Android API 21 (or 28 for `ppoll64`? seeing conflicting docs)

---

`iree_hal_buffer_calculate_range` outputs into a `iree_device_size_t`, which isn't directly compatible with

```
typedef struct {
  uint8_t* data;
  iree_host_size_t data_length;
} iree_byte_span_t;
```
benvanik added a commit that referenced this issue Jan 28, 2021
benvanik pushed a commit that referenced this issue Jan 28, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
ScottTodd pushed a commit to ScottTodd/iree that referenced this issue Jan 29, 2021
Removing unused HAL files/functions/types.

Removing last use of HAL C++ from the HAL VM module.

Swapping many C++ HAL types/enums for C ones.

Removing iree/base/bitfield.h.
The formatting functionality will reappear in iree_string_builder.

Removing iree/hal/cts/ for now until it can be ported to C.
Issue iree-org#3934 is tracking this.

Moving HAL C++ types to iree/hal/cc/.

Removing C++ command buffer validation as it'll be moved into C.

Porting the HAL C++ API to C.
Unfortunately the string handling code is still very dependent on abseil,
but everything else is now just plain C.

Fixing quoting on cmake variables that *must* be quoted. (iree-org#4404)

Removing unused iree/hal/testing/ mock types.

Adding a new arena type with a shared thread-safe block pool.
This will be used to provide storage for command buffers and other
builder types (submissions/etc) in the local HAL backend.

Fixing tracing macro errors with the latest VC++.

Got a new error emitted:
`error C4576: a parenthesized type followed by an initializer
list is a non-standard explicit type conversion syntax`

Unfortunately C99 supports paren-init and not non-paren-init and
C++ supports the opposite so this error is dumb. Oh well.

Porting a majority of Vulkan/Metal to C.

Removing Metal backend until it can be replaced.
This commit can be used to revive the configuration for the driver
and view a partially-ported version of it. The actual implementation
will need to be rebased onto the C type system and written in
Objective C. Note that the compiler backend has not been removed - we
can use that for verifying metal shader output.

Issue iree-org#4370 tracks reviving this.

Removing iree/base/time.h now that no C++ remains using it.

Windows ptr atomics fix (needs test coverage, obviously).

Ensure wait handles are zero-initialized.

Removing unused status results.

Adding support for cleaning up tasks when retired/discarded.

Making call and dispatch task closures independent types.

Adding batch task submission enqueuing.

Fixing executables with multiple pipelines in Vulkan.

Disabling executable linking until it can be fixed iree-org#4536.

Revive the HAL CTS using the C API. (iree-org#4498)

Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes iree-org#3934, part of iree-org#4369.

Allowing iree_task_barrier_t to be initialized in two steps.
This is required when incrementally building the barrier: you want to
insert the barrier into the task DAG prior to knowing what the dependent
tasks are.

Improving `iree_task_post_batch_select_worker`.
With the way command buffers are issued today it tended to bias toward
only dispatching on the current worker and - even if worked around -
would bias towards idle workers even after the batch is queuing work on
them. This more evenly distributes work when many tasks are dispatched
within the same batch.

Working around crap _mktemp behavior.
It only generates 26 unique names per thread o_o

Adding a new iree/hal/local/ path as the local CPU driver.
This subsumes the existing iree/hal/host/ and will allow us to share the
same device for all local execution - including mixing and matching
executables in different forms (AOT, vmla, JIT, etc) within the same
device. It also adds the (initial, unoptimized) task-system based
command buffer and semaphore implementations.

Porting both the dylib and vmla drivers to use iree/hal/local.
Both entire drivers are now just loader implementations and then shims
that match the existing registration. In the future there will just be
--driver=local and dylib/vmla will just be compiler registrations like
HAL driver registrations currently are.

Removing iree/hal/host/ now that it is unused.

Moving VMLA VM module to iree/modules/vmla/.

Fixing temp file path cleanup. Can't wait to remove this code.

Making IREE_EXPECT_OK/IREE_ASSERT_OK print better messages.

Removing unused line to remove warning.

Tweaking iree_atomic_* macros to better check types and adding a test.

Fixing a type typo in the python bindings.

Fixing third_party/half bazel-to-cmake mapping.

Fixing a race where threads start prior to their handle being assigned.

Treating push constants offset/length as bytes in the API.
IR still needs a fixup, but is fine for now.

Making iree_status_t a non-void type to get better warnings on misuse.

Force mapping on hal.allocator.wrap.byte_buffer (today).

Cleanup of compile-time detection of sanitizers to enable TSAN/MSAN.
Also adds --config=tsan and --config=msan to iree.bazelrc.

Making threads join on shutdown (for sanity).
Doesn't seem to change anything but there's not really a reason to
detach and I'd rather never have to think about this code again.

Fixing push constants not being included in executable layout caching.
This would cause all kind of badness when multiple executables shared
the same hal.interface bindings but had differing push constants.

Adding iree_task_pool_t tests.

Adding iree_task_queue_t tests.

Adding iree_task_scope_t tests.

Adding iree_task_list_discard test.

Adding iree_task_topology_t tests and simplifying allocation.
The max size on the stack is 3KB, which is fine for something transient
like this that is only used for construction of the executor.

Removing HAL backend implementations of fill/read/write/copy.
They were all implemented using mapping anyway and this way we only have
that code once and make the restriction that buffers be mappable part of
their usage uniformly.

Better error status when drivers are not registered.

Split iree/tools/test/simple.mlir as it was a PITA all as one.

Fix Vulkan GUI sample after HAL C changes. (iree-org#4603)

More fixes after HAL C changes. (iree-org#4604)

* Use `IREE_RESTRICT` for older MSVC versions.
* Update iree-run-module-vulkan-gui-main.cc
* Include <atomic> for std::atomic use in GetTempFile.

Tested CMake build of `all` (vmla+vulkan only) on my Windows machine, with samples and Vulkan enabled.

Properly handling nop tasks in the task system.

Adding tests for the various iree_task_t types.

Temporarily disabling failing task system wait test.
This case is not yet exercised from our code but I'll be fixing it ASAP
anyway.

Fixing off-by-one in minilcg128.

Fixing scope name length truncation.

Fixing ubsan-flagged potential undefined shift right behavior.

Android build fixes for HAL rewrite branch. (iree-org#4622)

Unfortunately not caught by any of our open source builds.

---

```
typedef size_t iree_host_size_t;
typedef uint64_t iree_device_size_t;
```

`iree_device_size_t` should use `% " PRIu64 "` instead of `%zu`

---

`ppoll` is available since Android API 21 (or 28 for `ppoll64`? seeing conflicting docs)

---

`iree_hal_buffer_calculate_range` outputs into a `iree_device_size_t`, which isn't directly compatible with

```
typedef struct {
  uint8_t* data;
  iree_host_size_t data_length;
} iree_byte_span_t;
```

Fixing ubsan discovery in topology tests on large machines.
Possibly: hard to test without 128 cores. I did try turning the topology
mask into a uint8_t on my 64 core machine and it passed --config=ubsan.

Add missing device release in CTS.

Disabling TaskWaitTest IssueSignaled for now.
The wait functionality isn't done yet.

Fallback to 1 thread when cpuinfo_get_cores_count() == 0.
benvanik pushed a commit that referenced this issue Jan 29, 2021
Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior [iree/hal/cts/ tests](https://github.com/google/iree/tree/6f1afa5ebf82d31dafc0c3e835c8baf3eea2ceda/iree/hal/cts), rebased on the new HAL C APIs, then expanded upon.

Tests pass with no validation layer warnings on the new Vulkan HAL on Windows with an NVIDIA GPU using latest drivers.

Fixes #3934, part of #4369.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hal/vulkan Runtime Vulkan GPU HAL backend runtime Relating to the IREE runtime library
Projects
None yet
Development

No branches or pull requests

3 participants