Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaomaosu committed Sep 25, 2024
1 parent 9a435b2 commit a7fe634
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
16 changes: 5 additions & 11 deletions source/loader/layers/sanitizer/asan_shadow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@

#pragma once

#include "common.hpp"
#include "asan_allocator.hpp"
#include "common.hpp"
#include <unordered_set>

namespace ur_sanitizer_layer {

struct ShadowMemory {
ShadowMemory(ur_context_handle_t Context, ur_device_handle_t Device)
: Context(Context), Device(Device) {}

virtual ~ShadowMemory() {}

virtual ur_result_t Setup() = 0;
Expand Down Expand Up @@ -63,9 +63,7 @@ struct ShadowMemoryCPU final : public ShadowMemory {
virtual ur_result_t EnqueuePoisonShadow(ur_queue_handle_t Queue, uptr Ptr,
uptr Size, u8 Value) override;

virtual size_t GetShadowSize() override {
return 0x80000000000ULL;
}
virtual size_t GetShadowSize() override { return 0x80000000000ULL; }
};

struct ShadowMemoryGPU : public ShadowMemory {
Expand Down Expand Up @@ -111,9 +109,7 @@ struct ShadowMemoryPVC final : public ShadowMemoryGPU {

virtual uptr MemToShadow(uptr Ptr) override;

virtual size_t GetShadowSize() override {
return 0x180000000000ULL;
}
virtual size_t GetShadowSize() override { return 0x180000000000ULL; }
};

/// Shadow Memory layout of GPU PVC device
Expand All @@ -132,9 +128,7 @@ struct ShadowMemoryDG2 final : public ShadowMemoryGPU {

virtual uptr MemToShadow(uptr Ptr) override;

virtual size_t GetShadowSize() override {
return 0x100000000000ULL;
}
virtual size_t GetShadowSize() override { return 0x100000000000ULL; }
};

} // namespace ur_sanitizer_layer
41 changes: 25 additions & 16 deletions source/loader/layers/sanitizer/ur_sanddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ __urdlllocal ur_result_t UR_APICALL urUSMFree(
///////////////////////////////////////////////////////////////////////////////
/// @brief Intercept function for urProgramCreateWithIL
__urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL(
ur_context_handle_t hContext, ///< [in] handle of the context instance
const void *pIL, ///< [in] pointer to IL binary.
size_t length, ///< [in] length of `pIL` in bytes.
const ur_program_properties_t *pProperties, ///< [in][optional] pointer to program creation properties.
ur_program_handle_t *phProgram ///< [out] pointer to handle of program object created.
ur_context_handle_t hContext, ///< [in] handle of the context instance
const void *pIL, ///< [in] pointer to IL binary.
size_t length, ///< [in] length of `pIL` in bytes.
const ur_program_properties_t *
pProperties, ///< [in][optional] pointer to program creation properties.
ur_program_handle_t
*phProgram ///< [out] pointer to handle of program object created.
) {
auto pfnProgramCreateWithIL =
getContext()->urDdiTable.Program.pfnCreateWithIL;
Expand All @@ -203,12 +205,15 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL(
///////////////////////////////////////////////////////////////////////////////
/// @brief Intercept function for urProgramCreateWithBinary
__urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary(
ur_context_handle_t hContext, ///< [in] handle of the context instance
ur_device_handle_t hDevice, ///< [in] handle to device associated with binary.
size_t size, ///< [in] size in bytes.
const uint8_t *pBinary, ///< [in] pointer to binary.
const ur_program_properties_t *pProperties, ///< [in][optional] pointer to program creation properties.
ur_program_handle_t *phProgram ///< [out] pointer to handle of Program object created.
ur_context_handle_t hContext, ///< [in] handle of the context instance
ur_device_handle_t
hDevice, ///< [in] handle to device associated with binary.
size_t size, ///< [in] size in bytes.
const uint8_t *pBinary, ///< [in] pointer to binary.
const ur_program_properties_t *
pProperties, ///< [in][optional] pointer to program creation properties.
ur_program_handle_t
*phProgram ///< [out] pointer to handle of Program object created.
) {
auto pfnProgramCreateWithBinary =
getContext()->urDdiTable.Program.pfnCreateWithBinary;
Expand All @@ -229,10 +234,13 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary(
///////////////////////////////////////////////////////////////////////////////
/// @brief Intercept function for urProgramCreateWithNativeHandle
__urdlllocal ur_result_t UR_APICALL urProgramCreateWithNativeHandle(
ur_native_handle_t hNativeProgram, ///< [in][nocheck] the native handle of the program.
ur_context_handle_t hContext, ///< [in] handle of the context instance
const ur_program_native_properties_t *pProperties, ///< [in][optional] pointer to native program properties struct.
ur_program_handle_t *phProgram ///< [out] pointer to the handle of the program object created.
ur_native_handle_t
hNativeProgram, ///< [in][nocheck] the native handle of the program.
ur_context_handle_t hContext, ///< [in] handle of the context instance
const ur_program_native_properties_t *
pProperties, ///< [in][optional] pointer to native program properties struct.
ur_program_handle_t *
phProgram ///< [out] pointer to the handle of the program object created.
) {
auto pfnProgramCreateWithNativeHandle =
getContext()->urDdiTable.Program.pfnCreateWithNativeHandle;
Expand All @@ -253,7 +261,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithNativeHandle(
///////////////////////////////////////////////////////////////////////////////
/// @brief Intercept function for urProgramRetain
__urdlllocal ur_result_t UR_APICALL urProgramRetain(
ur_program_handle_t hProgram ///< [in][retain] handle for the Program to retain
ur_program_handle_t
hProgram ///< [in][retain] handle for the Program to retain
) {
auto pfnRetain = getContext()->urDdiTable.Program.pfnRetain;

Expand Down

0 comments on commit a7fe634

Please sign in to comment.