Skip to content

Commit 197b7b2

Browse files
[NFC][libomptarget] move remaining device specific code out of omptarget-nvptx.h
Summary: [NFC][libomptarget] move remaining device specific code out of omptarget-nvptx.h Strictly there is one remaining difference wrt amdgcn - parallelLevel is volatile qualified on amdgcn and not on nvptx. Determining whether this is correct - and how to represent the different semantics of 'volatile' under various conditions - is beyond the scope of this code motion patch. Reviewers: ABataev, jdoerfert, grokos Subscribers: openmp-commits Tags: #openmp Differential Revision: https://reviews.llvm.org/D69424
1 parent 96601ec commit 197b7b2

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@
1515
#define __OMPTARGET_NVPTX_H
1616

1717
// std includes
18-
#include <stdint.h>
19-
#include <stdlib.h>
20-
2118
#include <inttypes.h>
22-
23-
// cuda includes
24-
#include <cuda.h>
2519
#include <math.h>
20+
#include <stdlib.h>
2621

2722
// local includes
23+
#include "target_impl.h"
2824
#include "debug.h" // debug
2925
#include "interface.h" // interfaces with omp, compiler, and user
3026
#include "option.h" // choices we have
@@ -86,20 +82,6 @@ class omptarget_nvptx_SharedArgs {
8682
extern __device__ __shared__ omptarget_nvptx_SharedArgs
8783
omptarget_nvptx_globalArgs;
8884

89-
// Data sharing related quantities, need to match what is used in the compiler.
90-
enum DATA_SHARING_SIZES {
91-
// The maximum number of workers in a kernel.
92-
DS_Max_Worker_Threads = 992,
93-
// The size reserved for data in a shared memory slot.
94-
DS_Slot_Size = 256,
95-
// The slot size that should be reserved for a working warp.
96-
DS_Worker_Warp_Slot_Size = WARPSIZE * DS_Slot_Size,
97-
// The maximum number of warps in use
98-
DS_Max_Warp_Number = 32,
99-
// The size of the preallocated shared memory buffer per team
100-
DS_Shared_Memory_Size = 128,
101-
};
102-
10385
// Data structure to keep in shared memory that traces the current slot, stack,
10486
// and frame pointer as well as the active threads that didn't exit the current
10587
// environment.

openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,25 @@
1212
#ifndef _TARGET_IMPL_H_
1313
#define _TARGET_IMPL_H_
1414

15+
#include <cuda.h>
1516
#include <stdint.h>
1617

1718
#include "option.h"
1819

20+
// Data sharing related quantities, need to match what is used in the compiler.
21+
enum DATA_SHARING_SIZES {
22+
// The maximum number of workers in a kernel.
23+
DS_Max_Worker_Threads = 992,
24+
// The size reserved for data in a shared memory slot.
25+
DS_Slot_Size = 256,
26+
// The slot size that should be reserved for a working warp.
27+
DS_Worker_Warp_Slot_Size = WARPSIZE * DS_Slot_Size,
28+
// The maximum number of warps in use
29+
DS_Max_Warp_Number = 32,
30+
// The size of the preallocated shared memory buffer per team
31+
DS_Shared_Memory_Size = 128,
32+
};
33+
1934
INLINE void __kmpc_impl_unpack(uint64_t val, uint32_t &lo, uint32_t &hi) {
2035
asm volatile("mov.b64 {%0,%1}, %2;" : "=r"(lo), "=r"(hi) : "l"(val));
2136
}

0 commit comments

Comments
 (0)