Skip to content

Commit 0560417

Browse files
[NFC][OpenMP] Remove unsused functions from DeviceRTL
These functions are not used by the Fortran compiler and can be safely removed.
1 parent 3f181e5 commit 0560417

File tree

4 files changed

+0
-130
lines changed

4 files changed

+0
-130
lines changed

offload/DeviceRTL/src/Kernel.cpp

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -153,60 +153,5 @@ void __kmpc_target_deinit() {
153153

154154
void __kmpc_specialized_kernel_init() { mapping::init(/*IsSPMD=*/true); }
155155

156-
#ifndef FORTRAN_NO_LONGER_NEEDS
157-
int32_t __kmpc_target_init_v1(int64_t *, int8_t Mode,
158-
int8_t UseGenericStateMachine,
159-
int8_t RequiresFullRuntime) {
160-
KernelEnvironmentTy KE{{static_cast<uint8_t>(UseGenericStateMachine),
161-
/*MayUseNestedParallelism=*/1,
162-
static_cast<llvm::omp::OMPTgtExecModeFlags>(Mode)},
163-
/*Ident=*/nullptr,
164-
/*DebugIndentionLevel=*/0};
165-
KernelLaunchEnvironmentTy KernelLaunchEnvironment;
166-
int32_t res = __kmpc_target_init(KE, KernelLaunchEnvironment);
167-
if (Mode & llvm::omp::OMP_TGT_EXEC_MODE_SPMD) {
168-
169-
uint32_t TId = mapping::getThreadIdInBlock();
170-
171-
uint32_t NThreadsICV = icv::NThreads;
172-
uint32_t NumThreads = mapping::getNumberOfThreadsInBlock();
173-
174-
if (NThreadsICV != 0 && NThreadsICV < NumThreads)
175-
NumThreads = NThreadsICV;
176-
177-
synchronize::threadsAligned(atomic::seq_cst);
178-
if (TId == 0) {
179-
// Note that the order here is important. `icv::Level` has to be updated
180-
// last or the other updates will cause a thread specific state to be
181-
// created.
182-
state::ParallelTeamSize = NumThreads;
183-
icv::ActiveLevel = 1u;
184-
icv::Level = 1u;
185-
}
186-
synchronize::threadsAligned(atomic::seq_cst);
187-
}
188-
return res;
189-
}
190-
191-
void __kmpc_target_deinit_v1(int64_t *, int8_t Mode,
192-
int8_t RequiresFullRuntime) {
193-
uint32_t TId = mapping::getThreadIdInBlock();
194-
synchronize::threadsAligned(atomic::seq_cst);
195-
196-
if (TId == 0) {
197-
// Reverse order of deinitialization
198-
icv::Level = 0u;
199-
icv::ActiveLevel = 0u;
200-
state::ParallelTeamSize = 1u;
201-
}
202-
// Synchronize all threads to make sure every thread exits the scope above;
203-
// otherwise the following assertions and the assumption in
204-
// __kmpc_target_deinit may not hold.
205-
synchronize::threadsAligned(atomic::seq_cst);
206-
__kmpc_target_deinit();
207-
}
208-
209-
#endif
210-
211156
int8_t __kmpc_is_spmd_exec_mode() { return mapping::isSPMDMode(); }
212157
}

offload/DeviceRTL/src/LibM.cpp

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -33,52 +33,6 @@ using size_t = decltype(sizeof(char));
3333

3434
extern "C" {
3535

36-
#ifndef FORTRAN_NO_LONGER_NEEDS
37-
// Attach Fortran runtimes which are used by Classic Flang
38-
double __f90_dmodulov(double a, double p) {
39-
double d;
40-
d = a - floor(a/p) * p;
41-
return d;
42-
}
43-
44-
float __f90_amodulov(float a, float p) { return __f90_dmodulov(a, p); }
45-
46-
int32_t __f90_modulov(int32_t a, int32_t p) {
47-
int32_t q, r;
48-
49-
q = a / p;
50-
r = a - q * p;
51-
if (r != 0 && (a ^ p) < 0) { /* signs differ */
52-
r += p;
53-
}
54-
return r;
55-
}
56-
57-
int64_t __f90_i8modulov_i8(int64_t a, int64_t p) {
58-
int64_t q, r;
59-
60-
q = a / p;
61-
r = a - q * p;
62-
if (r != 0 && (a ^ p) < 0) { /* signs differ */
63-
r += (p);
64-
}
65-
return r;
66-
}
67-
68-
int16_t __f90_imodulov(int16_t a, int16_t p) {
69-
int32_t q, r;
70-
71-
q = a / p;
72-
r = a - q * p;
73-
if (r != 0 && (a ^ p) < 0) { /* signs differ */
74-
r += p;
75-
}
76-
return r;
77-
}
78-
}
79-
80-
#endif
81-
8236
#endif // __AMDGPU__
8337

8438
#ifdef __NVPTX__

offload/DeviceRTL/src/Reduction.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,13 +400,6 @@ int32_t __kmpc_nvptx_teams_reduce_nowait_v2(
400400

401401
void __kmpc_nvptx_end_reduce(int32_t TId) {}
402402

403-
#ifndef FORTRAN_NO_LONGER_NEEDS
404-
int32_t __kmpc_nvptx_parallel_reduce_nowait_simple_spmd(
405-
int32_t TId, int32_t num_vars, uint64_t reduce_size, void *reduce_data,
406-
ShuffleReductFnTy shflFct, InterWarpCopyFnTy cpyFct) {
407-
return nvptx_parallel_reduce_nowait(reduce_data, shflFct, cpyFct);
408-
}
409-
#endif
410403
void __kmpc_nvptx_end_reduce_nowait(int32_t TId) {}
411404
}
412405

offload/DeviceRTL/src/Workshare.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -739,28 +739,6 @@ void __kmpc_distribute_static_init_8u(IdentTy *loc, int32_t global_tid,
739739

740740
void __kmpc_for_static_fini(IdentTy *loc, int32_t global_tid) {}
741741

742-
#ifndef FORTRAN_NO_LONGER_NEEDS
743-
void __kmpc_for_static_init_4_simple_spmd(int64_t *, int32_t global_tid,
744-
int32_t schedtype, int32_t *plastiter,
745-
int32_t *plower, int32_t *pupper,
746-
int32_t *pstride, int32_t incr,
747-
int32_t chunk) {
748-
749-
omptarget_nvptx_LoopSupport<int32_t, int32_t>::for_static_init(
750-
global_tid, schedtype, plastiter, plower, pupper, pstride, chunk,
751-
/*IsSPMDExecutionMode=*/true);
752-
}
753-
754-
void __kmpc_for_static_init_8_simple_spmd(int64_t *, int32_t global_tid,
755-
int32_t schedtype, int32_t *plastiter,
756-
int64_t *plower, int64_t *pupper,
757-
int64_t *pstride, int64_t incr,
758-
int64_t chunk) {
759-
omptarget_nvptx_LoopSupport<int64_t, int64_t>::for_static_init(
760-
global_tid, schedtype, plastiter, plower, pupper, pstride, chunk,
761-
/*IsSPMDExecutionMode=*/true);
762-
}
763-
#endif
764742
void __kmpc_distribute_static_fini(IdentTy *loc, int32_t global_tid) {}
765743
}
766744

0 commit comments

Comments
 (0)