Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ endif()
# Prefix path to Caffe2 headers. If a directory containing installed Caffe2
# headers was inadvertently added to the list of include directories, prefixing
# PROJECT_SOURCE_DIR means this source tree always takes precedence.
include_directories(BEFORE ${PROJECT_SOURCE_DIR})
include_directories(BEFORE SYSTEM ${PROJECT_SOURCE_DIR})

# Prefix path to generated Caffe2 headers. These need to take precedence over
# their empty counterparts located in PROJECT_SOURCE_DIR.
Expand Down
4 changes: 4 additions & 0 deletions aten/src/ATen/jit_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
#include <string>

// AT_USE_JITERATOR(), controls whether we jit some elementwise kernels
#if defined(USE_ROCM) && defined(USE_ASAN)
#define AT_USE_JITERATOR() false
#else
#define AT_USE_JITERATOR() true
#endif
#define jiterator_stringify(...) std::string(#__VA_ARGS__);
6 changes: 4 additions & 2 deletions aten/src/ATen/native/cuda/UnarySpecialOpsKernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ void i1_kernel_cuda(TensorIteratorBase& iter) {
#else
AT_DISPATCH_FLOATING_TYPES_AND2(ScalarType::Half, ScalarType::BFloat16, iter.common_dtype(), "i1_cuda", [&]() {
gpu_kernel(iter, []GPU_LAMBDA(scalar_t a) -> scalar_t {
return calc_i1(a);
using opmath_t = at::opmath_type<scalar_t>;
return calc_i1<opmath_t>(a);
});
});
#endif // AT_USE_JITERATOR()
Expand All @@ -114,7 +115,8 @@ void i1e_kernel_cuda(TensorIteratorBase& iter) {
#else
AT_DISPATCH_FLOATING_TYPES_AND2(ScalarType::Half, ScalarType::BFloat16, iter.common_dtype(), "i1e_cuda", [&]() {
gpu_kernel(iter, []GPU_LAMBDA(scalar_t a) -> scalar_t {
return calc_i1e(a);
using opmath_t = at::opmath_type<scalar_t>;
return calc_i1e<opmath_t>(a);
});
});
#endif
Expand Down
5 changes: 4 additions & 1 deletion aten/src/ATen/test/quantized_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
using namespace at;
#ifndef ATEN_CPU_STATIC_DISPATCH

// GPU ASAN: temporarily commenting out quantized tests
// due to compiler error.
#if 0
TEST(TestQTensor, QuantDequantAPIs) {
auto num_elements = 10;
Tensor r = at::ones({num_elements});
Expand Down Expand Up @@ -350,5 +353,5 @@ TEST(TestQTensor, TestArmVectorizedQuantizeDequantize) {
std::numeric_limits<int32_t>::max());
}
#endif // (__ARM_NEON__) || defined(__aarch64__)

#endif
#endif // ATEN_CPU_STATIC_DISPATCH
8 changes: 5 additions & 3 deletions caffe2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1856,9 +1856,11 @@ if(BUILD_TEST)
if(TARGET Sanitizer::address)
target_link_libraries(${test_name}_${CPU_CAPABILITY} Sanitizer::address)
endif()
if(TARGET Sanitizer::undefined)
target_link_libraries(${test_name}_${CPU_CAPABILITY} Sanitizer::undefined)
endif()
# GPU ASAN: prevent cmake to add a -fsanitize=undefined.
# TODO: extend cmake facility to support GPU+CPU asan.
#if(TARGET Sanitizer::undefined)
# target_link_libraries(${test_name}_${CPU_CAPABILITY} Sanitizer::undefined)
#endif()
endif()
if(USE_LSAN AND TARGET Sanitizer::leak)
target_link_libraries(${test_name}_${CPU_CAPABILITY} Sanitizer::leak)
Expand Down
8 changes: 5 additions & 3 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,15 @@ if(USE_ASAN OR USE_LSAN OR USE_TSAN)
if(USE_ASAN)
if(TARGET Sanitizer::address)
list(APPEND Caffe2_DEPENDENCY_LIBS Sanitizer::address)
add_definitions(-DUSE_ASAN)
else()
message(WARNING "ASAN not found. Suppress this warning with -DUSE_ASAN=OFF.")
caffe2_update_option(USE_ASAN OFF)
endif()
if(TARGET Sanitizer::undefined)
list(APPEND Caffe2_DEPENDENCY_LIBS Sanitizer::undefined)
endif()
# GPU ASAN: prevent cmake to add -fsanitize=undefined to compiler option.
#if(TARGET Sanitizer::undefined)
# list(APPEND Caffe2_DEPENDENCY_LIBS Sanitizer::undefined)
#endif()
endif()
if(USE_LSAN)
if(TARGET Sanitizer::leak)
Expand Down
8 changes: 5 additions & 3 deletions torch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ set(TORCH_PYTHON_LINK_LIBRARIES
if(USE_ASAN AND TARGET Sanitizer::address)
list(APPEND TORCH_PYTHON_LINK_LIBRARIES Sanitizer::address)
endif()
if(USE_ASAN AND TARGET Sanitizer::undefined)
list(APPEND TORCH_PYTHON_LINK_LIBRARIES Sanitizer::undefined)
endif()
# GPU ASAN: prevent cmake to add -fsanitize=undefined to compile
# options.
#if(USE_ASAN AND TARGET Sanitizer::undefined)
# list(APPEND TORCH_PYTHON_LINK_LIBRARIES Sanitizer::undefined)
#endif()
if(USE_LSAN AND TARGET Sanitizer::leak)
list(APPEND TORCH_PYTHON_LINK_LIBRARIES Sanitizer::leak)
endif()
Expand Down