Skip to content

Revive the HAL CTS using the C API. - #4498

Merged
ScottTodd merged 5 commits into
iree-org:staging-hal-rewritefrom
ScottTodd:cts-c
Jan 19, 2021
Merged

ScottTodd merged 5 commits into
iree-org:staging-hal-rewritefrom
ScottTodd:cts-c

Conversation

@ScottTodd

@ScottTodd ScottTodd commented Jan 13, 2021 •

Copy link
Copy Markdown
Member

Adding back a Conformance Test Suite of tests for HAL drivers. These tests were forked from the prior iree/hal/cts/ tests, 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 ScottTodd added infrastructure Relating to build systems, CI, or testing runtime Relating to the IREE runtime library hal/vulkan Runtime Vulkan GPU HAL backend hal/api IREE's public C hardware abstraction layer API labels Jan 13, 2021
@ScottTodd
ScottTodd requested a review from benvanik January 13, 2021 01:03
@google-cla google-cla Bot added the cla: yes label Jan 13, 2021
Comment thread iree/hal/cts/allocator_test.cc Resolved
Comment thread iree/hal/cts/allocator_test.cc Resolved
Comment thread iree/hal/cts/command_buffer_test.cc Resolved
Comment thread iree/hal/cts/command_buffer_test.cc Resolved
Comment thread iree/hal/cts/command_buffer_test.cc Resolved
Comment thread iree/hal/cts/command_buffer_test.cc Resolved
Comment thread iree/hal/cts/cts_test_base.h Resolved
Comment thread iree/hal/cts/cts_test_base.h Resolved
@ScottTodd
ScottTodd requested a review from benvanik January 13, 2021 17:43
@ScottTodd
ScottTodd force-pushed the cts-c branch 3 times, most recently from bff9a8c to d39983e Compare January 13, 2021 20:56
* Port driver_test and allocator_test to only use HAL C APIs.
* Port semaphore_test to only using HAL C APIs.
* Move device allocator to base class, fix usage in allocator test.
* Start to port command_buffer_test.
* Port CommandBufferTest::FillBufferWithRepeatedBytes to the HAL C API.
* Port CommandBufferTest::CopyWholeBuffer to the HAL C API.
* Port CommandBufferTest::CopySubBuffer to the HAL C API.
* Delete sanitizer_suppressions.txt. Unclear if it is actually useful.
* Rebase on staging-hal-rewrite.
* Expand coverage in allocator_test.
* Expand coverage in command_buffer_test, fix queue family selection.
* Remove old test build targets.
* Re-enable SemaphoreTest.WaitAny (passing on NVIDIA now).
* Adjust buffer compatibility checks in allocator test.
* Switch cts_test_base to use iree_status_t instead of StatusOr.
* Rework command_buffer_test to not map memory and better handle errors.
* Prune some build deps, log more info in driver_test.
* Touch up comments and test conditions in semaphore_test.
* Expand coverage in semaphore_test, disable WAIT_MODE_ANY test.
* Fix semaphore value data types in command_buffer_test.
@ScottTodd

Copy link
Copy Markdown
Member Author

There are some follow-up tasks I'd like to work on here, but I'll merge this for now so you can start using it and expanding test coverage as you bring up the new CPU backend.

  • more granular command buffer tests
  • README with information about what the CTS is / aims to be, how to run it for out of tree backends (when that works)
  • dedicated tests for buffer mapping (or other optional features), which are skipped for backends that are missing support
  • switching infinite timeouts to test timeouts (5 seconds?) for semaphore operations
  • tests using executables

@ScottTodd
ScottTodd merged commit 77fc75d into iree-org:staging-hal-rewrite Jan 19, 2021
@ScottTodd
ScottTodd deleted the cts-c branch January 19, 2021 16:34
benvanik pushed a commit that referenced this pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pushed a commit that referenced this pull request 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 pull request 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 pull request 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 pushed a commit that referenced this pull request 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 pull request 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 pull request 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.
@ScottTodd ScottTodd mentioned this pull request Jan 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hal/api IREE's public C hardware abstraction layer API hal/vulkan Runtime Vulkan GPU HAL backend infrastructure Relating to build systems, CI, or testing runtime Relating to the IREE runtime library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants