We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9707f0e commit 791c3b6Copy full SHA for 791c3b6
clang/lib/DPCT/APINamesCUDNN.inc
@@ -7,6 +7,11 @@
7
//===-----------------------------------------------------------------===//
8
9
// Base API
10
+FEATURE_REQUEST_FACTORY(HelperFeatureEnum::DnnlUtils_get_version,
11
+ CALL_FACTORY_ENTRY("cudnnGetVersion",
12
+ CALL(MapNames::getDpctNamespace() +
13
+ "dnnl::get_version")))
14
+
15
FEATURE_REQUEST_FACTORY(HelperFeatureEnum::DnnlUtils_engine_ext,
16
ASSIGNABLE_FACTORY(MEMBER_CALL_FACTORY_ENTRY(
17
"cudnnCreate", DEREF(ARG_WC(0)), false,
clang/lib/DPCT/APINames_cuDNN.inc
@@ -94,7 +94,7 @@ ENTRY(cudnnGetTensor4dDescriptor, cudnnGetTensor4dDescriptor, true, NO_FLAG, P4,
94
ENTRY(cudnnGetTensorNdDescriptor, cudnnGetTensorNdDescriptor, true, NO_FLAG, P4, "Successful")
95
ENTRY(cudnnGetTensorSizeInBytes, cudnnGetTensorSizeInBytes, true, NO_FLAG, P4, "Successful")
96
ENTRY(cudnnGetTensorTransformDescriptor, cudnnGetTensorTransformDescriptor, false, NO_FLAG, P4, "comment")
97
-ENTRY(cudnnGetVersion, cudnnGetVersion, false, NO_FLAG, P4, "comment")
+ENTRY(cudnnGetVersion, cudnnGetVersion, true, NO_FLAG, P4, "comment")
98
ENTRY(cudnnInitTransformDest, cudnnInitTransformDest, false, NO_FLAG, P4, "comment")
99
ENTRY(cudnnLRNCrossChannelForward, cudnnLRNCrossChannelForward, true, NO_FLAG, P4, "Successful")
100
ENTRY(cudnnNormalizationForwardInference, cudnnNormalizationForwardInference, true, NO_FLAG, P4, "comment")
clang/lib/DPCT/DNNAPIMigration.cpp
@@ -179,7 +179,7 @@ void CuDNNAPIRule::registerMatcher(ast_matchers::MatchFinder &MF) {
179
"cudnnCreateDropoutDescriptor", "cudnnSetDropoutDescriptor",
180
"cudnnGetDropoutDescriptor", "cudnnDropoutGetReserveSpaceSize",
181
"cudnnRestoreDropoutDescriptor", "cudnnDropoutForward", "cudnnDropoutBackward",
182
- "cudnnDestroyDropoutDescriptor");
+ "cudnnDestroyDropoutDescriptor", "cudnnGetVersion");
183
};
184
185
MF.addMatcher(
clang/runtime/dpct-rt/include/dnnl_utils.hpp.inc
@@ -38,6 +38,15 @@
38
39
namespace dpct {
40
namespace dnnl {
41
+// DPCT_LABEL_BEGIN|get_version|dpct::dnnl
42
+// DPCT_DEPENDENCY_EMPTY
43
+// DPCT_CODE
44
+/// Get concatenated library version as an integer.
45
+static inline size_t get_version() {
46
+ const ::dnnl::version_t *ver = ::dnnl::version();
47
+ return ver->major * 1000 + ver->minor * 100 + ver->patch;
48
+}
49
+// DPCT_LABEL_END
50
class engine_ext;
51
typedef oneapi::mkl::rng::philox4x32x10 rng_engine_t;
52
// DPCT_LABEL_BEGIN|memory_format_tag|dpct::dnnl
clang/test/dpct/dnn/version.cu
@@ -0,0 +1,14 @@
1
+// RUN: dpct -in-root %S -out-root %T/version %S/version.cu --cuda-include-path="%cuda-path/include" -- -std=c++14 -x cuda --cuda-host-only
2
+// RUN: FileCheck --input-file %T/version/version.dp.cpp --match-full-lines %s
3
+#include <cuda_runtime.h>
4
+#include <cudnn.h>
5
+#include <iostream>
6
+#include <vector>
+int main() {
+ // CHECK: size_t version = dpct::dnnl::get_version();
+ size_t version = cudnnGetVersion();
+ return 0;
clang/test/dpct/helper_files_ref/include/dnnl_utils.hpp
@@ -26,6 +26,11 @@
26
27
28
29
30
31
32
33
34
35
36
/// An enum class representing memory layout. Used by
clang/test/dpct/test_api_level/DnnlUtils/api_test28.cu
@@ -0,0 +1,20 @@
+// RUN: dpct --format-range=none --use-custom-helper=api -out-root %T/DnnlUtils/api_test28_out %s --cuda-include-path="%cuda-path/include" -- -x cuda --cuda-host-only
+// RUN: grep "IsCalled" %T/DnnlUtils/api_test28_out/MainSourceFiles.yaml | wc -l > %T/DnnlUtils/api_test28_out/count.txt
+// RUN: FileCheck --input-file %T/DnnlUtils/api_test28_out/count.txt --match-full-lines %s
+// RUN: rm -rf %T/DnnlUtils/api_test28_out
+// CHECK: 2
+// TEST_FEATURE: DnnlUtils_get_version
+ size_t ver = cudnnGetVersion();
18
19
20
0 commit comments