-
Notifications
You must be signed in to change notification settings - Fork 790
[DeviceSanitizer] Support "-fsanitize-ignorelist=" to disable sanitizing on some of kernels #15294
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
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
30d18e1
wip
AllanZyne 848587b
wip
AllanZyne ce5ef1f
wip
AllanZyne 79d226c
Merge branch 'sycl' into review/yang/fix_kernel_filter
AllanZyne a522451
wip
AllanZyne f97c8b8
wip
AllanZyne 8684ab7
Merge branch 'sycl' into review/yang/fix_kernel_filter
AllanZyne 0f18783
wip
AllanZyne fd4feac
wip
AllanZyne cd1fe71
Merge branch 'sycl' into review/yang/fix_kernel_filter
AllanZyne 6e06fed
wip
AllanZyne 3c60ce4
wip
AllanZyne 8473c58
fix crash
AllanZyne 48716c0
fix crash
AllanZyne 2ba2662
wip
AllanZyne 20f08fe
wip
AllanZyne 18eb60d
wip
AllanZyne 6036d1e
wip
AllanZyne bba8dfe
Merge branch 'sycl' into review/yang/fix_kernel_filter
AllanZyne f614a47
wip
AllanZyne 1aa7a67
fix comment
AllanZyne 2e08e44
nit
AllanZyne 7e8641a
nit
AllanZyne 2e148cb
nit
AllanZyne 20ebf54
address comments
AllanZyne acffb6c
address comments
AllanZyne dbae6c7
fix test fail
AllanZyne 172aea7
fix test fail
AllanZyne 8740fa6
Merge branch 'sycl' into review/yang/fix_kernel_filter
AllanZyne 458c7ec
fix ESIMD
AllanZyne 59b89ef
Merge branch 'sycl' into review/yang/fix_kernel_filter
AllanZyne bfd3384
fix lit test
AllanZyne 79a7d21
fix comment
AllanZyne e9df350
fix sycl-device-global-size
AllanZyne 9a64792
fix sycl-host-access
AllanZyne 6d605ae
fix sycl-host-access
AllanZyne c2807fd
Merge branch 'sycl' into review/yang/fix_kernel_filter
AllanZyne 484717f
fix merge
AllanZyne 24ddd0c
fix build
AllanZyne 456a90f
Merge branch 'sycl' into review/yang/fix_kernel_filter
AllanZyne 76c80dd
Merge branch 'sycl' into review/yang/fix_kernel_filter
AllanZyne 504e6cd
Bump UR tag
callumfare f57e5eb
Merge branch 'sycl' into review/yang/fix_kernel_filter
callumfare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//===-- AsanKernelMetadata.h - fix kernel medatadata for sanitizer ---===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// This pass fixes attributes and metadata of the global variable | ||
// "__AsanKernelMetadata" | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
#include "llvm/IR/PassManager.h" | ||
AllanZyne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
namespace llvm { | ||
|
||
class AsanKernelMetadataPass : public PassInfoMixin<AsanKernelMetadataPass> { | ||
public: | ||
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); | ||
}; | ||
|
||
} // namespace llvm |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
//===-- AsanKernelMetadata.cpp - fix kernel medatadata for sanitizer -===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// This pass fixes attributes and metadata of global variable | ||
// "__AsanKernelMetadata". | ||
// We treat "__AsanKernelMetadata" as a device global variable, so that it can | ||
// be read by runtime. | ||
// "spirv.Decorations" is removed by llvm-link, so we add it here again. | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "llvm/SYCLLowerIR/AsanKernelMetadata.h" | ||
|
||
#include "llvm/IR/IRBuilder.h" | ||
|
||
#define DEBUG_TYPE "AsanKernelMetadata" | ||
|
||
using namespace llvm; | ||
|
||
namespace llvm { | ||
|
||
constexpr StringRef SPIRV_DECOR_MD_KIND = "spirv.Decorations"; | ||
constexpr uint32_t SPIRV_HOST_ACCESS_DECOR = 6147; | ||
|
||
PreservedAnalyses AsanKernelMetadataPass::run(Module &M, | ||
ModuleAnalysisManager &MAM) { | ||
auto *KernelMetadata = M.getNamedGlobal("__AsanKernelMetadata"); | ||
if (!KernelMetadata) { | ||
return PreservedAnalyses::all(); | ||
} | ||
|
||
auto &DL = M.getDataLayout(); | ||
auto &Ctx = M.getContext(); | ||
|
||
// Fix attributes | ||
KernelMetadata->addAttribute( | ||
"sycl-device-global-size", | ||
std::to_string(DL.getTypeAllocSize(KernelMetadata->getValueType()))); | ||
|
||
// Fix metadata | ||
unsigned MDKindID = Ctx.getMDKindID(SPIRV_DECOR_MD_KIND); | ||
|
||
SmallVector<Metadata *, 1> MDOps; | ||
|
||
SmallVector<Metadata *, 3> MD; | ||
auto *Ty = Type::getInt32Ty(Ctx); | ||
MD.push_back(ConstantAsMetadata::get( | ||
Constant::getIntegerValue(Ty, APInt(32, SPIRV_HOST_ACCESS_DECOR)))); | ||
AllanZyne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
MD.push_back( | ||
ConstantAsMetadata::get(Constant::getIntegerValue(Ty, APInt(32, 0)))); | ||
MD.push_back(MDString::get(Ctx, "_Z20__AsanKernelMetadata")); | ||
|
||
MDOps.push_back(MDNode::get(Ctx, MD)); | ||
|
||
KernelMetadata->addMetadata(MDKindID, *MDNode::get(Ctx, MDOps)); | ||
|
||
return PreservedAnalyses::none(); | ||
} | ||
|
||
} // namespace llvm |
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
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
Oops, something went wrong.
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.