-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Being able to dynamically combine tokens to await a runtime-dependent number of DMA transfers is a requirement for implementing legalization of DMA transfers in the `dma` dialect. This PR therefore adds the `combined_tokens` op which combines multiple tokens into one. The lowering for Snitch leverages the monotonicity guarantee of IDs to combine them. Note that this only works with a single channel DMA right now. As this subsumes the multi-token capabilities of `wait_for_transfers`, it has been renamed to just `wait_for_transfer` and only accepts a single token input now.
- Loading branch information
Showing
12 changed files
with
110 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
codegen/tests/Conversion/ConvertDMAToLLVM/combine_tokens.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// RUN: quidditch-opt %s --quidditch-convert-to-llvm | FileCheck %s | ||
|
||
// CHECK-LABEL: @test | ||
// CHECK-SAME: %[[ARG0:[[:alnum:]]+]] | ||
func.func private @test(%arg0 : !dma.token) { | ||
// CHECK: llvm.br ^[[BODY:[[:alnum:]]+]] | ||
// CHECK: ^[[BODY]]: | ||
// CHECK-NEXT: %[[ID:.*]] = llvm.inline_asm has_side_effects ".insn r 0x2b, 0, 0b100, $0, zero, zero | ||
// CHECK-SAME: "=r" | ||
// CHECK-SAME: -> i32 | ||
// CHECK: %[[COND:.*]] = llvm.icmp "ult" %[[ID]], %[[ARG0]] | ||
// CHECK: llvm.cond_br %[[COND]], ^[[BODY]], ^[[CONT:[[:alnum:]]+]] | ||
// CHECK: ^[[CONT]]: | ||
dma.wait_for_transfer %arg0 | ||
// CHECK-NEXT: llvm.return | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
// RUN: quidditch-opt %s --verify-roundtrip | ||
|
||
func.func @test(%arg0 : memref<f64>) { | ||
dma.wait_for_transfers | ||
return | ||
} | ||
|
||
func.func @test3(%arg0 : tensor<?x4xf64>) -> (tensor<?x4xf64>, !dma.token) { | ||
func.func @test(%arg0 : tensor<?x4xf64>) -> (tensor<?x4xf64>, !dma.token) { | ||
%0:2 = dma.start_tensor_copy of %arg0 to #quidditch_snitch.l1_encoding -> tensor<?x4xf64> | ||
return %0#0, %0#1 : tensor<?x4xf64>, !dma.token | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters