2020-03-22 18:13:40 +08:00
|
|
|
//===- TestConvertGPUKernelToCubin.cpp - Test gpu kernel cubin lowering ---===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h"
|
|
|
|
#include "mlir/Pass/Pass.h"
|
|
|
|
#include "mlir/Pass/PassManager.h"
|
|
|
|
using namespace mlir;
|
|
|
|
|
Fix a warning building on my machine, NFC. warning: unused function 'compilePtxToCubinForTesting'
Summary: Also eliminate the redunant anon namespace around the already static function.
Reviewers: herhut
Subscribers: hiraditya, steven_wu, dexonsmith, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76627
2020-03-24 00:51:07 +08:00
|
|
|
#if MLIR_CUDA_CONVERSIONS_ENABLED
|
2020-03-22 18:13:40 +08:00
|
|
|
static OwnedCubin compilePtxToCubinForTesting(const std::string &, Location,
|
|
|
|
StringRef) {
|
|
|
|
const char data[] = "CUBIN";
|
|
|
|
return std::make_unique<std::vector<char>>(data, data + sizeof(data) - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace mlir {
|
|
|
|
void registerTestConvertGPUKernelToCubinPass() {
|
|
|
|
PassPipelineRegistration<>("test-kernel-to-cubin",
|
|
|
|
"Convert all kernel functions to CUDA cubin blobs",
|
|
|
|
[](OpPassManager &pm) {
|
|
|
|
pm.addPass(createConvertGPUKernelToCubinPass(
|
|
|
|
compilePtxToCubinForTesting));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} // namespace mlir
|
|
|
|
#endif
|