-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: intwanghao <[email protected]>
- Loading branch information
1 parent
42b0f63
commit 8b1a2c8
Showing
3 changed files
with
32 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// RUN: dpct --rule-file=%S/../../tools/dpct/DpctOptRules/macro.yaml --format-range=none -out-root %T/macro_rule %s --cuda-include-path="%cuda-path/include" -- -x cuda --cuda-host-only | ||
// RUN: FileCheck --input-file %T/macro_rule/macro_rule.dp.cpp --match-full-lines %s | ||
// RUN: %if build_lit %{icpx -c -fsycl %T/macro_rule/macro_rule.dp.cpp -o %T/macro_rule/macro_rule.dp.o %} | ||
#include <cuda_runtime.h> | ||
|
||
#define CUDA_CHECK(err) err | ||
|
||
int main() { | ||
int *ptr; | ||
// CHECK: DPCT_CHECK_ERROR(ptr = (int *)sycl::malloc_device(10, dpct::get_in_order_queue())); | ||
CUDA_CHECK(cudaMalloc(&ptr, 10)); | ||
return 0; | ||
} |
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,18 @@ | ||
# Copyright (C) Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
|
||
# This file is an example of user defined migration rules. | ||
# Applying this rule will make DPCT migrate macro CUDA_CHECK to DPCT_CHECK_ERROR. | ||
# This file will be installed to folder: | ||
# {dpct_install_folder}/extensions/opt_rules. | ||
# The rule specified in this file can be imported with commandline option: | ||
# --rule-file={dpct_install_folder}/extensions/opt_rules/macro.yaml | ||
--- | ||
- Rule: rule_error_check_macro # specify an unique name(ID) of the rule | ||
Kind: Macro # specify the kind of the rule | ||
Priority: Takeover # select the priority if the rule conflicts with another one. value = Fallback/Default/Takeover | ||
In: CUDA_CHECK # the target macro need to be migrate | ||
Out: DPCT_CHECK_ERROR # the new macro name | ||
Includes: [] # if the new macro depends on header files, specify it here as a list | ||
# e.g.["header_1.h", "<vector>"] |