Skip to content

Merge main -> google - #3120

Merged
copybara-service[bot] merged 11 commits into
iree-org:googlefrom
hanhanW:main-to-google
Sep 11, 2020
Merged

copybara-service[bot] merged 11 commits into
iree-org:googlefrom
hanhanW:main-to-google

Conversation

@hanhanW

@hanhanW hanhanW commented Sep 11, 2020

Copy link
Copy Markdown
Contributor

antiagainst and others added 11 commits September 10, 2020 09:48
* d0fcc9d Merge pull request iree-org#3110 from hanhanW:google-to-main
* 17323a3 Synchronize submodules
* f901e6b Integrate TF at tensorflow/tensorflow@622d9a212a42
* 01e4d9c Integrate LLVM at llvm/llvm-project@52f0837778b6
* [cmake] Add options for enabling Clang sanitizers (iree-org#2832)

* Fix C/C++ Flags appending
…-org#3089)

The internals are still synchronous, but this at least shows that the ABI supports asynchronous calling behavior.

Only tested on Windows with native timeline semaphore support (NVIDIA).

Progress on iree-org#1285
Follow-up to iree-org#3089 . Tested with timeline semaphore emulation forced enabled, on Windows with native Vulkan support (NVIDIA).
This improves debuggability here by outputting the actual error messages
we get from LLVM.
Progress on iree-org#1890.

This splits 

* CommandBufferDispatchOp -> CommandBufferDispatchOp / CommandBufferDispatchSymbolOp
* CommandBufferDispatchIndirectOp -> CommandBufferDispatchIndirectOp / CommandBufferDispatchIndirectSymbolOp

A new `ResolveEntryPointOrdinalsPass` runs after linking but prior to serialization, converting the ops using references to ops using ordinals. Backends may choose to record with or without references. Since the VulkanSPIRV target may split dispatches, it uses ordinals directly and must solve linking in some specialized way (this will at least need more attention as we implement linking).
…org#3118)

This makes async the "default", with sync wrapping async, instead of the other way around. Now we can push semaphores down further into the compiler (e.g. to remove hal.ex.submit_and_wait).

Progress on iree-org#1285

---

If the test is hard to read, here's a sample from simple.mlir's translation:
* Note how the `$sync` function creates a semaphore to pass into the `$async` function and waits for it to be incremented from `0` to `1` before returning. The `$async` function still waits and signals, but could instead pass the semaphores into the raw function for a `hal.submit`, removing the need for `hal.ex.submit_and_wait`.

Before:
```mlir
  func @abs$sync(%arg0: !hal.buffer_view) -> !hal.buffer_view attributes {iree.abi.stub, iree.module.export = "abs", iree.reflection = {f = "I6!B3!t6R6!B3!t6", fv = "1"}} {
    %buffer = hal.buffer_view.buffer %arg0 : !hal.buffer
    %0 = call @abs(%buffer) : (!hal.buffer) -> !hal.buffer
    %view = hal.buffer_view.create %0, shape = [], element_type = 16777248 : !hal.buffer_view
    return %view : !hal.buffer_view
  }
  func @abs$async(%arg0: !hal.semaphore, %arg1: index, %arg2: !hal.buffer_view, %arg3: !hal.semaphore, %arg4: index) -> !hal.buffer_view attributes {iree.module.export = "abs$async"} {
    %0 = hal.semaphore.await %arg0, min_value = %arg1 : i32
    hal.check_success %0, "semaphore wait failed"
    %1 = call @abs$sync(%arg2) : (!hal.buffer_view) -> !hal.buffer_view
    hal.semaphore.signal %arg3, value = %arg4
    return %1 : !hal.buffer_view
  }
```

After:
```mlir
  func @abs$async(%arg0: !hal.semaphore, %arg1: index, %arg2: !hal.buffer_view, %arg3: !hal.semaphore, %arg4: index) -> !hal.buffer_view attributes {iree.module.export = "abs$async"} {
    %0 = hal.semaphore.await %arg0, min_value = %arg1 : i32
    hal.check_success %0, "semaphore wait failed"
    %buffer = hal.buffer_view.buffer %arg2 : !hal.buffer
    %1 = call @abs(%buffer) : (!hal.buffer) -> !hal.buffer
    %view = hal.buffer_view.create %1, shape = [], element_type = 16777248 : !hal.buffer_view
    hal.semaphore.signal %arg3, value = %arg4
    return %view : !hal.buffer_view
  }
  func @abs$sync(%arg0: !hal.buffer_view) -> !hal.buffer_view attributes {iree.abi.stub, iree.module.export = "abs", iree.reflection = {f = "I6!B3!t6R6!B3!t6", fv = "1"}} {
    %c0 = constant 0 : index
    %c1 = constant 1 : index
    %dev = hal.ex.shared_device : !hal.device
    %semaphore = hal.semaphore.create %dev, initial_value = %c0 : !hal.semaphore
    %0 = call @abs$async(%semaphore, %c0, %arg0, %semaphore, %c1) : (!hal.semaphore, index, !hal.buffer_view, !hal.semaphore, index) -> !hal.buffer_view
    %1 = hal.semaphore.await %semaphore, min_value = %c1 : i32
    hal.check_success %1, "semaphore wait failed"
    return %0 : !hal.buffer_view
  }
```
@google-cla google-cla Bot added the cla: yes label Sep 11, 2020
@copybara-service
copybara-service Bot merged commit 5b26407 into iree-org:google Sep 11, 2020
@hanhanW
hanhanW deleted the main-to-google branch September 11, 2020 17:33
@hanhanW hanhanW mentioned this pull request Sep 11, 2020
hanhanW added a commit that referenced this pull request Sep 12, 2020
* 5b26407 Merge pull request #3120 from hanhanW:main-to-google
* f3ed1be Synchronize submodules
* bbd6a602 Integrate LLVM at llvm/llvm-project@009cd4e49103
* 2728681 Synchronize submodules
* 0857d5f Integrate TF at tensorflow/tensorflow@ef9971b6d7a1
* e9b83a4 Synchronize submodules
* f32f2ae Integrate LLVM at llvm/llvm-project@be7cef789e75
* 388e74b Remove mlir-auto-init.cpp : registration is explicit now.
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.

5 participants