-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir][print]Add functions for printing memref f16/bf16/i16 #75094
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
Merged
Conversation
This file contains hidden or 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
|
@llvm/pr-subscribers-mlir-execution-engine @llvm/pr-subscribers-mlir Author: Yinying Li (yinying-lisa-li) ChangesFull diff: https://github.com/llvm/llvm-project/pull/75094.diff 3 Files Affected:
diff --git a/mlir/include/mlir/ExecutionEngine/RunnerUtils.h b/mlir/include/mlir/ExecutionEngine/RunnerUtils.h
index f998ed53b3403b..ffa506bd0b0416 100644
--- a/mlir/include/mlir/ExecutionEngine/RunnerUtils.h
+++ b/mlir/include/mlir/ExecutionEngine/RunnerUtils.h
@@ -31,14 +31,14 @@
#define MLIR_RUNNERUTILS_EXPORT __attribute__((visibility("default")))
#endif // _WIN32
+#include "mlir/ExecutionEngine/CRunnerUtils.h"
+#include "mlir/ExecutionEngine/Float16bits.h"
#include <assert.h>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
-#include "mlir/ExecutionEngine/CRunnerUtils.h"
-
template <typename T, typename StreamType>
void printMemRefMetaData(StreamType &os, const DynamicMemRefType<T> &v) {
// Make the printed pointer format platform independent by casting it to an
@@ -369,10 +369,16 @@ _mlir_ciface_printMemrefShapeC64(UnrankedMemRefType<impl::complex64> *m);
extern "C" MLIR_RUNNERUTILS_EXPORT void
_mlir_ciface_printMemrefI8(UnrankedMemRefType<int8_t> *m);
extern "C" MLIR_RUNNERUTILS_EXPORT void
+_mlir_ciface_printMemrefI16(UnrankedMemRefType<int16_t> *m);
+extern "C" MLIR_RUNNERUTILS_EXPORT void
_mlir_ciface_printMemrefI32(UnrankedMemRefType<int32_t> *m);
extern "C" MLIR_RUNNERUTILS_EXPORT void
_mlir_ciface_printMemrefI64(UnrankedMemRefType<int64_t> *m);
extern "C" MLIR_RUNNERUTILS_EXPORT void
+_mlir_ciface_printMemrefF16(UnrankedMemRefType<f16> *m);
+extern "C" MLIR_RUNNERUTILS_EXPORT void
+_mlir_ciface_printMemrefBF16(UnrankedMemRefType<bf16> *m);
+extern "C" MLIR_RUNNERUTILS_EXPORT void
_mlir_ciface_printMemrefF32(UnrankedMemRefType<float> *m);
extern "C" MLIR_RUNNERUTILS_EXPORT void
_mlir_ciface_printMemrefF64(UnrankedMemRefType<double> *m);
diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index 70c5a07ad1ab23..2f391b7698cbb0 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -157,6 +157,9 @@ if(LLVM_ENABLE_PIC)
RunnerUtils.cpp
EXCLUDE_FROM_LIBMLIR
+
+ LINK_LIBS PUBLIC
+ mlir_float16_utils
)
target_compile_definitions(mlir_runner_utils PRIVATE mlir_runner_utils_EXPORTS)
diff --git a/mlir/lib/ExecutionEngine/RunnerUtils.cpp b/mlir/lib/ExecutionEngine/RunnerUtils.cpp
index bbfd3a6b11c2a1..378aa7ce35ef16 100644
--- a/mlir/lib/ExecutionEngine/RunnerUtils.cpp
+++ b/mlir/lib/ExecutionEngine/RunnerUtils.cpp
@@ -81,6 +81,10 @@ extern "C" void _mlir_ciface_printMemrefI8(UnrankedMemRefType<int8_t> *M) {
impl::printMemRef(*M);
}
+extern "C" void _mlir_ciface_printMemrefI16(UnrankedMemRefType<int16_t> *M) {
+ impl::printMemRef(*M);
+}
+
extern "C" void _mlir_ciface_printMemrefI32(UnrankedMemRefType<int32_t> *M) {
impl::printMemRef(*M);
}
@@ -89,6 +93,14 @@ extern "C" void _mlir_ciface_printMemrefI64(UnrankedMemRefType<int64_t> *M) {
impl::printMemRef(*M);
}
+extern "C" void _mlir_ciface_printMemrefF16(UnrankedMemRefType<f16> *M) {
+ impl::printMemRef(*M);
+}
+
+extern "C" void _mlir_ciface_printMemrefBF16(UnrankedMemRefType<bf16> *M) {
+ impl::printMemRef(*M);
+}
+
extern "C" void _mlir_ciface_printMemrefF32(UnrankedMemRefType<float> *M) {
impl::printMemRef(*M);
}
|
ftynse
reviewed
Dec 12, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test.
2010ff0
to
d5b102d
Compare
aartbik
approved these changes
Dec 13, 2023
81cd998
to
55fdf1b
Compare
aartbik
approved these changes
Dec 13, 2023
55fdf1b
to
f0af709
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.