Add windows build support into ROCr (#912)

Make sure ROCR can be compiled under windows. Extra setup for the windows build environment is required. The change should not have any functional changes under Linux.
This commit is contained in:
German Andryeyev
2025-09-19 10:10:17 -04:00
committed by GitHub
parent 96a0d16eda
commit 913743d433
40 changed files with 5476 additions and 280 deletions
@@ -3,7 +3,7 @@
// The University of Illinois/NCSA
// Open Source License (NCSA)
//
// Copyright (c) 2014-2020, Advanced Micro Devices, Inc. All rights reserved.
// Copyright (c) 2014-2025, Advanced Micro Devices, Inc. All rights reserved.
//
// Developed by:
//
@@ -40,12 +40,14 @@
//
////////////////////////////////////////////////////////////////////////////////
#include "executable.hpp"
#include <libelf.h>
#include <limits.h>
#if defined(__linux__)
#include <link.h>
#include <unistd.h>
#else
#include <cstdint>
#endif
#include <algorithm>
#include <cstddef>
@@ -61,6 +63,8 @@
#include "amd_options.hpp"
#include "core/util/utils.h"
#include "executable.hpp"
#include "AMDHSAKernelDescriptor.h"
using namespace rocr::amd::hsa;
@@ -88,7 +92,12 @@ static __forceinline link_map*& r_debug_tail() {
namespace rocr {
// Having a side effect prevents call site optimization that allows removal of a noinline function call
// with no side effect.
__attribute__((noinline)) void _loader_debug_state() {
#if defined(__linux__)
__attribute__((noinline))
#else
__declspec(noinline)
#endif
void _loader_debug_state() {
static volatile int function_needs_a_side_effect = 0;
function_needs_a_side_effect ^= 1;
}