Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AMDGPU] Non hostcall printf support for HIP
This is an alternative to currently existing hostcall implementation and uses printf buffer similar to OpenCL, The data stored in the buffer (i.e the data frame) for each printf call are as follows, 1. Control DWord - contains info regarding stream, format string constness and size of data frame 2. Hash of the format string (if constant) else the format string itself 3. Printf arguments (each aligned to 8 byte boundary) The format string Hash is generated using LLVM's MD5 Message-Digest Algorithm implementation and only low 64 bits are used. The implementation still uses amdhsa metadata and hash is stored as part of format string itself to ensure minimal changes in runtime. Differential Revision: https://reviews.llvm.org/D150427
- Loading branch information
Showing
13 changed files
with
892 additions
and
17 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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Create module flag for printf kind. | ||
|
||
// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \ | ||
// RUN: -o - %s | FileCheck %s -check-prefix=HOSTCALL | ||
|
||
// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \ | ||
// RUN: -mprintf-kind=hostcall -o - %s | FileCheck %s -check-prefix=HOSTCALL | ||
|
||
// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \ | ||
// RUN: -mprintf-kind=buffered -o - %s | FileCheck -check-prefix=BUFFERED %s | ||
|
||
// RUN: not %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \ | ||
// RUN: -mprintf-kind=none -o - %s 2>&1| FileCheck %s -check-prefix=INV | ||
|
||
// HOSTCALL: !{{.*}} = !{i32 1, !"amdgpu_printf_kind", !"hostcall"} | ||
// BUFFERED: !{{.*}} = !{i32 1, !"amdgpu_printf_kind", !"buffered"} | ||
// INV: error: invalid value 'none' in '-mprintf-kind=none' |
Oops, something went wrong.