Skip to content

Commit 9a45d79

Browse files
authored
Merge pull request ROCm#2395 from emankov/amd-develop
[HIPIFY][FILE][test][Windows] Added support for testing `cuFile` on Windows
2 parents 00969d7 + 122db0b commit 9a45d79

File tree

5 files changed

+51
-0
lines changed

5 files changed

+51
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,8 @@ if(HIPIFY_CLANG_TESTS OR HIPIFY_CLANG_TESTS_ONLY)
404404

405405
if(CUDA_FILE_ROOT_DIR STREQUAL "")
406406
set(CUDA_FILE_ROOT_DIR OFF)
407+
else()
408+
set(CUDA_FILE_ROOT_DIR "${CUDA_FILE_ROOT_DIR}/include")
407409
endif()
408410

409411
message(STATUS "Found CUDA config:")

tests/lit.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ config.excludes = ['cmdparser.hpp']
1616
config.excludes.append('spatial_batch_norm_op.h')
1717
config.excludes.append('common_cudnn.h')
1818
config.excludes.append('inc.h')
19+
config.excludes.append('inet.h')
20+
config.excludes.append('types.h')
21+
config.excludes.append('socket.h')
1922

2023
delimiter = "===============================================================";
2124
print(delimiter)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Fake arpa/inet.h to appease cuFile testing on Windows
2+
#pragma once
3+
4+
#ifdef _WIN32
5+
#ifndef WIN32_LEAN_AND_MEAN
6+
#define WIN32_LEAN_AND_MEAN
7+
#endif
8+
#include <winsock2.h>
9+
#include <ws2tcpip.h>
10+
#else
11+
// On Linux, bypass this shim and load the real system header
12+
#include_next <arpa/inet.h>
13+
#endif
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Fake sys/socket.h to appease cuFile testing on Windows
2+
#pragma once
3+
4+
#ifdef _WIN32
5+
#ifndef WIN32_LEAN_AND_MEAN
6+
#define WIN32_LEAN_AND_MEAN
7+
#endif
8+
#include <winsock2.h>
9+
10+
// Sometimes Windows needs this for types like ssize_t
11+
#include <BaseTsd.h>
12+
typedef SSIZE_T ssize_t;
13+
#else
14+
// On Linux, bypass this shim and load the real system header
15+
#include_next <sys/socket.h>
16+
#endif
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Fake sys/types.h to appease cuFile testing on Windows
2+
#pragma once
3+
4+
// ALWAYS load the real system header first (works for Windows SDK and Linux glibc)
5+
#include_next <sys/types.h>
6+
7+
// 2. Add our Linux missing types
8+
#ifdef _WIN32
9+
#include <stdint.h>
10+
11+
// Define the Linux 64-bit file offset type for Windows
12+
typedef int64_t loff_t;
13+
typedef int64_t off64_t;
14+
15+
// (Optional) Include corecrt just in case standard sys/types.h misses it
16+
#include <corecrt.h>
17+
#endif

0 commit comments

Comments
 (0)