-
Notifications
You must be signed in to change notification settings - Fork 2
fix for code warnings at compiation time #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,7 +201,8 @@ void collectLoops(OklLoopInfo& loopInfo, std::list<OklLoopInfo*>& out) { | |
| } | ||
| #endif | ||
|
|
||
| std::pair<LoopMetaData, LoopMetaData> splitTileAttr(OklLoopInfo& loopInfo, const oklt::Rewriter& r) { | ||
| std::pair<LoopMetaData, LoopMetaData> splitTileAttr(OklLoopInfo& loopInfo, | ||
| const oklt::Rewriter& r) { | ||
| auto sz = util::parseStrTo<size_t>(loopInfo.tileSize); | ||
|
|
||
| // Prepare first loop | ||
|
|
@@ -210,15 +211,11 @@ std::pair<LoopMetaData, LoopMetaData> splitTileAttr(OklLoopInfo& loopInfo, const | |
| if (sz.value_or(1024) > 0) { | ||
| if (firstMeta.inc.val.empty()) { | ||
| firstMeta.inc.val = loopInfo.tileSize; | ||
| switch (firstMeta.inc.op.uo) { | ||
| case UnOp::PreInc: | ||
| case UnOp::PostInc: | ||
| firstMeta.inc.op.bo = BinOp::AddAssign; | ||
| break; | ||
| case UnOp::PreDec: | ||
| case UnOp::PostDec: | ||
| firstMeta.inc.op.bo = BinOp::RemoveAssign; | ||
| break; | ||
| if (firstMeta.inc.op.uo == UnOp::PreInc || firstMeta.inc.op.uo == UnOp::PostInc) { | ||
| firstMeta.inc.op.bo = BinOp::AddAssign; | ||
| } | ||
| if (firstMeta.inc.op.uo == UnOp::PreDec || firstMeta.inc.op.uo == UnOp::PostDec) { | ||
| firstMeta.inc.op.bo = BinOp::RemoveAssign; | ||
| } | ||
| } else { | ||
| firstMeta.inc.val = "(" + loopInfo.tileSize + " * " + firstMeta.inc.val + ")"; | ||
|
|
@@ -228,13 +225,11 @@ std::pair<LoopMetaData, LoopMetaData> splitTileAttr(OklLoopInfo& loopInfo, const | |
| // Prepare second loop | ||
| auto secondMeta = LoopMetaData(loopInfo, r); | ||
| secondMeta.range.start = firstMeta.var.name; | ||
| switch (secondMeta.condition.op) { | ||
| case BinOp::Le: | ||
| secondMeta.condition.op = BinOp::Lt; | ||
| break; | ||
| case BinOp::Ge: | ||
| secondMeta.condition.op = BinOp::Gt; | ||
| break; | ||
| if (secondMeta.condition.op == BinOp::Le) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that a correct behavior that LessEqual translates to LessThan?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that okay that we skip other BinOp cases?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is how it was. I would imagine that there could be any kind of Binary/Unary operation for example: As far as I can see we just pass it as is
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| secondMeta.condition.op = BinOp::Lt; | ||
| } | ||
| if (secondMeta.condition.op == BinOp::Ge) { | ||
| secondMeta.condition.op = BinOp::Gt; | ||
| } | ||
| if (sz.value_or(1024) > 0) { | ||
| secondMeta.range.end = "(" + firstMeta.var.name + " + " + loopInfo.tileSize + ")"; | ||
|
|
@@ -374,8 +369,8 @@ HandleResult handleLauncherKernelAttribute(SessionStage& s, | |
| auto& rewriter = s.getRewriter(); | ||
|
|
||
| if (!sema.getParsingKernelInfo()) { | ||
| return tl::make_unexpected(Error{OkltPipelineErrorCode::INTERNAL_ERROR_KERNEL_INFO_NULL, | ||
| "handleKernelAttribute"}); | ||
| return tl::make_unexpected( | ||
| Error{OkltPipelineErrorCode::INTERNAL_ERROR_KERNEL_INFO_NULL, "handleKernelAttribute"}); | ||
| } | ||
|
|
||
| auto kernelInfo = *sema.getParsingKernelInfo(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,62 +1,63 @@ | ||
| #include <cuda_runtime.h> | ||
| #include <cuda_pipeline_primitives.h> | ||
| #include <cuda_runtime.h> | ||
|
|
||
| namespace { | ||
| // Math functions | ||
|
|
||
| // Single precision | ||
| [[maybe_unused]] inline __device__ float okl_exp10f(float x) { return exp10f(x); } | ||
| [[maybe_unused]] inline __device__ float okl_exp10f(float x) { | ||
| return exp10f(x); | ||
| } | ||
|
|
||
| // Warp Shuffle Functions | ||
| template <class T> | ||
| inline __device__ T okl_shfl_sync(unsigned mask, T var, int srcLane, | ||
| int width = warpSize) { | ||
| return __shfl_sync(mask, var, srcLane, width); | ||
| inline __device__ T okl_shfl_sync(unsigned mask, T var, int srcLane, int width = warpSize) { | ||
| return __shfl_sync(mask, var, srcLane, width); | ||
| } | ||
|
|
||
| template <class T> | ||
| inline __device__ T okl_shfl_up_sync(unsigned mask, T var, unsigned int delta, | ||
| int width = warpSize) { | ||
| return __shfl_up_sync(mask, var, delta, width); | ||
| inline __device__ T | ||
| okl_shfl_up_sync(unsigned mask, T var, unsigned int delta, int width = warpSize) { | ||
| return __shfl_up_sync(mask, var, delta, width); | ||
| } | ||
|
|
||
| template <class T> | ||
| inline __device__ T okl_shfl_down_sync(unsigned mask, T var, unsigned int delta, | ||
| int width = warpSize) { | ||
| return __shfl_down_sync(mask, var, delta, width); | ||
| inline __device__ T | ||
| okl_shfl_down_sync(unsigned mask, T var, unsigned int delta, int width = warpSize) { | ||
| return __shfl_down_sync(mask, var, delta, width); | ||
| } | ||
|
|
||
| template <class T> | ||
| inline __device__ T okl_shfl_xor_sync(unsigned mask, T var, int laneMask, | ||
| int width = warpSize) { | ||
| return __shfl_xor_sync(mask, laneMask, width); | ||
| inline __device__ T okl_shfl_xor_sync(unsigned mask, T var, int laneMask, int width = warpSize) { | ||
| return __shfl_xor_sync(mask, var, laneMask, width); | ||
| } | ||
|
|
||
| // Pipeline Primitives Interface | ||
| [[maybe_unused]] _CUDA_PIPELINE_STATIC_QUALIFIER void | ||
| okl_memcpy_async(void *__restrict__ dst_shared, | ||
| const void *__restrict__ src_global, | ||
| size_t size_and_align, size_t zfill = 0) { | ||
| __pipeline_memcpy_async(dst_shared, src_global, size_and_align); | ||
| [[maybe_unused]] _CUDA_PIPELINE_STATIC_QUALIFIER void okl_memcpy_async( | ||
| void* __restrict__ dst_shared, | ||
| const void* __restrict__ src_global, | ||
| size_t size_and_align, | ||
| size_t zfill = 0) { | ||
| __pipeline_memcpy_async(dst_shared, src_global, size_and_align); | ||
| } | ||
|
|
||
| [[maybe_unused]] _CUDA_PIPELINE_STATIC_QUALIFIER void okl_pipeline_commit() { | ||
| __pipeline_commit(); | ||
| __pipeline_commit(); | ||
| } | ||
|
|
||
| [[maybe_unused]] _CUDA_PIPELINE_STATIC_QUALIFIER void | ||
| okl_pipeline_wait_prior(size_t N) { __pipeline_wait_prior(N); } | ||
| } // namespace | ||
| [[maybe_unused]] _CUDA_PIPELINE_STATIC_QUALIFIER void okl_pipeline_wait_prior(size_t N) { | ||
| __pipeline_wait_prior(N); | ||
| } | ||
| } // namespace | ||
|
|
||
| extern "C" __global__ | ||
| __launch_bounds__(1) void _occa_intrinsic_builtin_0(const float *fVec, | ||
| float *fSum) { | ||
| { | ||
| int i = (0) + blockIdx.x; | ||
| extern "C" __global__ __launch_bounds__(1) void _occa_intrinsic_builtin_0(const float* fVec, | ||
| float* fSum) { | ||
| { | ||
| int j = (0) + threadIdx.x; | ||
| float value = okl_exp10f(fVec[i]); | ||
| atomicAdd(&(*fSum), value); | ||
| int i = (0) + blockIdx.x; | ||
| { | ||
| int j = (0) + threadIdx.x; | ||
| float value = okl_exp10f(fVec[i]); | ||
| atomicAdd(&(*fSum), value); | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we still don't handle UnOp::Other case, which will leave firstMeta.inc.op.bo uninitialized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would ask the author of this code what should happen
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
::Otherwere originally there as default values.In case
OPcannot be properly detected (or there is no increment/decrement at all), the defaultOtheris set.If the
Otheris detected at the end of loop parsing, an error must be raised.That is how it was originally written for
launcher PoC.