Files
TheRock/compiler/amd-llvm/amd/device-libs/asanrtl/inc/asan_util.h
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

64 lines
1.9 KiB
C

/*===--------------------------------------------------------------------------
* ROCm Device Libraries
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*===------------------------------------------------------------------------*/
#pragma once
#include "ockl.h"
typedef ulong uptr;
typedef unsigned char u8;
typedef signed char s8;
typedef unsigned short u16;
typedef short s16;
typedef unsigned long u64;
#define ASAN_SHADOW 3
#define SHADOW_GRANULARITY (1ULL << ASAN_SHADOW)
#define CALL_BYTES 4
#define GET_CALLER_PC() ((uptr)__builtin_return_address(0) - CALL_BYTES)
#define WORKGROUP_ID(dim) __builtin_amdgcn_workgroup_id_##dim()
#define USED __attribute__((used))
#define NO_INLINE __attribute__((noinline))
#define NO_SANITIZE_ADDR __attribute__((no_sanitize("address")))
#define REPORT_IMPL(caller_pc, addr, is_write, size, no_abort) \
uptr read = is_write; \
if (no_abort) \
read |= 0xFFFFFFFF00000000; \
\
__ockl_sanitizer_report(addr, caller_pc, WORKGROUP_ID(x), WORKGROUP_ID(y), \
WORKGROUP_ID(z), __ockl_get_local_linear_id(), \
read, size);
NO_SANITIZE_ADDR
static bool
is_aligned_by_granularity(uptr addr)
{
return (addr & (SHADOW_GRANULARITY - 1)) == 0;
}
// round up size to the nearest multiple of boundary.
NO_SANITIZE_ADDR
static uptr
round_upto(uptr size, uptr boundary)
{
return (size + boundary - 1) & ~(boundary - 1);
}
// round down size to the nearest multiple of boundary.
NO_SANITIZE_ADDR
static uptr
round_downto(uptr size, uptr boundary)
{
return size & ~(boundary - 1);
}