[OpenMP] Remove compilation warning when using clang to compile bc files.

Summary: Minor printf format correction. NVCC ignore those. Clang will give warning on these if debug is enabled.

Reviewers: grokos

Reviewed By: grokos

Subscribers: openmp-commits

Tags: #openmp

Differential Revision: https://reviews.llvm.org/D45528

llvm-svn: 330944
This commit is contained in:
Guansong Zhang 2018-04-26 14:06:53 +00:00
parent 15e894baee
commit ad6c26516b
5 changed files with 16 additions and 14 deletions

View File

@ -45,7 +45,7 @@ INLINE Counter omptarget_nvptx_CounterGroup::Next() {
// set priv to n, to be used in later waitOrRelease // set priv to n, to be used in later waitOrRelease
INLINE void omptarget_nvptx_CounterGroup::Complete(Counter &priv, Counter n) { INLINE void omptarget_nvptx_CounterGroup::Complete(Counter &priv, Counter n) {
PRINT(LD_SYNCD, "complete priv counter 0x%llx with val %lld->%lld (+%d)\n", PRINT(LD_SYNCD, "complete priv counter 0x%llx with val %llu->%llu (+%llu)\n",
P64(&priv), P64(priv), P64(priv + n), n); P64(&priv), P64(priv), P64(priv + n), n);
priv += n; priv += n;
} }

View File

@ -55,7 +55,7 @@ EXTERN int omp_get_max_threads(void) {
rc = GetNumberOfProcsInTeam(); rc = GetNumberOfProcsInTeam();
ASSERT0(LT_FUSSY, rc >= 0, "bad number of threads"); ASSERT0(LT_FUSSY, rc >= 0, "bad number of threads");
} }
PRINT(LD_IO, "call omp_get_max_threads() return %\n", rc); PRINT(LD_IO, "call omp_get_max_threads() return %d\n", rc);
return rc; return rc;
} }
@ -192,7 +192,7 @@ EXTERN int omp_get_ancestor_thread_num(int level) {
omp_sched_t sched = currTaskDescr->GetRuntimeSched(); omp_sched_t sched = currTaskDescr->GetRuntimeSched();
PRINT(LD_ALL, PRINT(LD_ALL,
"task descr %s %d: %s, in par %d, dyn %d, rt sched %d," "task descr %s %d: %s, in par %d, dyn %d, rt sched %d,"
" chunk %lld; tid %d, tnum %d, nthreads %d\n", " chunk %" PRIu64 "; tid %d, tnum %d, nthreads %d\n",
"ancestor", steps, "ancestor", steps,
(currTaskDescr->IsParallelConstruct() ? "par" : "task"), (currTaskDescr->IsParallelConstruct() ? "par" : "task"),
currTaskDescr->InParallelRegion(), currTaskDescr->IsDynamic(), currTaskDescr->InParallelRegion(), currTaskDescr->IsDynamic(),
@ -261,7 +261,7 @@ EXTERN void omp_set_schedule(omp_sched_t kind, int modifier) {
omptarget_nvptx_TaskDescr *currTaskDescr = getMyTopTaskDescriptor(); omptarget_nvptx_TaskDescr *currTaskDescr = getMyTopTaskDescriptor();
currTaskDescr->SetRuntimeSched(kind); currTaskDescr->SetRuntimeSched(kind);
currTaskDescr->RuntimeChunkSize() = modifier; currTaskDescr->RuntimeChunkSize() = modifier;
PRINT(LD_IOD, "omp_set_schedule did set sched %d & modif %d\n", PRINT(LD_IOD, "omp_set_schedule did set sched %d & modif %" PRIu64 "\n",
(int)currTaskDescr->GetRuntimeSched(), (int)currTaskDescr->GetRuntimeSched(),
currTaskDescr->RuntimeChunkSize()); currTaskDescr->RuntimeChunkSize());
} }

View File

@ -240,8 +240,8 @@ public:
// Process schedule. // Process schedule.
if (tnum == 1 || tripCount <= 1 || OrderedSchedule(schedule)) { if (tnum == 1 || tripCount <= 1 || OrderedSchedule(schedule)) {
PRINT(LD_LOOP, PRINT(LD_LOOP,
"go sequential as tnum=%d, trip count %lld, ordered sched=%d\n", "go sequential as tnum=%ld, trip count %lld, ordered sched=%d\n",
tnum, P64(tripCount), schedule); (long)tnum, P64(tripCount), schedule);
schedule = kmp_sched_static_chunk; schedule = kmp_sched_static_chunk;
chunk = tripCount; // one thread gets the whole loop chunk = tripCount; // one thread gets the whole loop
@ -301,8 +301,8 @@ public:
omptarget_nvptx_threadPrivateContext->NextLowerBound(tid) = lb; omptarget_nvptx_threadPrivateContext->NextLowerBound(tid) = lb;
omptarget_nvptx_threadPrivateContext->Stride(tid) = stride; omptarget_nvptx_threadPrivateContext->Stride(tid) = stride;
PRINT(LD_LOOP, PRINT(LD_LOOP,
"dispatch init (static chunk) : num threads = %d, ub = %lld," "dispatch init (static chunk) : num threads = %d, ub = %" PRId64 ","
"next lower bound = %lld, stride = %lld\n", "next lower bound = %llu, stride = %llu\n",
GetNumberOfOmpThreads(tid, isSPMDMode(), isRuntimeUninitialized()), GetNumberOfOmpThreads(tid, isSPMDMode(), isRuntimeUninitialized()),
omptarget_nvptx_threadPrivateContext->LoopUpperBound(tid), omptarget_nvptx_threadPrivateContext->LoopUpperBound(tid),
omptarget_nvptx_threadPrivateContext->NextLowerBound(tid), omptarget_nvptx_threadPrivateContext->NextLowerBound(tid),
@ -322,8 +322,8 @@ public:
omptarget_nvptx_threadPrivateContext->NextLowerBound(tid) = lb; omptarget_nvptx_threadPrivateContext->NextLowerBound(tid) = lb;
omptarget_nvptx_threadPrivateContext->Stride(tid) = stride; omptarget_nvptx_threadPrivateContext->Stride(tid) = stride;
PRINT(LD_LOOP, PRINT(LD_LOOP,
"dispatch init (static nochunk) : num threads = %d, ub = %lld," "dispatch init (static nochunk) : num threads = %d, ub = %" PRId64 ","
"next lower bound = %lld, stride = %lld\n", "next lower bound = %llu, stride = %llu\n",
GetNumberOfOmpThreads(tid, isSPMDMode(), isRuntimeUninitialized()), GetNumberOfOmpThreads(tid, isSPMDMode(), isRuntimeUninitialized()),
omptarget_nvptx_threadPrivateContext->LoopUpperBound(tid), omptarget_nvptx_threadPrivateContext->LoopUpperBound(tid),
omptarget_nvptx_threadPrivateContext->NextLowerBound(tid), omptarget_nvptx_threadPrivateContext->NextLowerBound(tid),
@ -338,8 +338,8 @@ public:
omptarget_nvptx_threadPrivateContext->Chunk(tid) = chunk; omptarget_nvptx_threadPrivateContext->Chunk(tid) = chunk;
omptarget_nvptx_threadPrivateContext->EventsNumber(tid) = eventNum; omptarget_nvptx_threadPrivateContext->EventsNumber(tid) = eventNum;
PRINT(LD_LOOP, PRINT(LD_LOOP,
"dispatch init (dyn) : num threads = %d, ub = %lld, chunk %lld, " "dispatch init (dyn) : num threads = %d, ub = %" PRId64 ", chunk %" PRIu64 ", "
"events number = %lld\n", "events number = %llu\n",
GetNumberOfOmpThreads(tid, isSPMDMode(), isRuntimeUninitialized()), GetNumberOfOmpThreads(tid, isSPMDMode(), isRuntimeUninitialized()),
omptarget_nvptx_threadPrivateContext->LoopUpperBound(tid), omptarget_nvptx_threadPrivateContext->LoopUpperBound(tid),
omptarget_nvptx_threadPrivateContext->Chunk(tid), omptarget_nvptx_threadPrivateContext->Chunk(tid),

View File

@ -19,6 +19,8 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <inttypes.h>
// cuda includes // cuda includes
#include <cuda.h> #include <cuda.h>
#include <math.h> #include <math.h>

View File

@ -177,8 +177,8 @@ INLINE unsigned long PadBytes(unsigned long size,
INLINE void *SafeMalloc(size_t size, const char *msg) // check if success INLINE void *SafeMalloc(size_t size, const char *msg) // check if success
{ {
void *ptr = malloc(size); void *ptr = malloc(size);
PRINT(LD_MEM, "malloc data of size %d for %s: 0x%llx\n", size, msg, P64(ptr)); PRINT(LD_MEM, "malloc data of size %zu for %s: 0x%llx\n", size, msg, P64(ptr));
ASSERT(LT_SAFETY, ptr, "failed to allocate %d bytes for %s\n", size, msg); ASSERT(LT_SAFETY, ptr, "failed to allocate %zu bytes for %s\n", size, msg);
return ptr; return ptr;
} }