Commit 1c28cd3c authored by Mateusz Belicki's avatar Mateusz Belicki Committed by gbsbuild

Enabling OpReadClockKRH SPRIV instruction

Change-Id: I6d023803aba1999f640750bf30568fa1a5fb8ae1
parent 94d0063c
......@@ -406,6 +406,8 @@ _SPIRV_OP(OpGenericCastToPtrExplicit)
// Ballot extension
_SPIRV_OP(OpSubgroupBallotKHR)
_SPIRV_OP(OpSubgroupFirstInvocationKHR)
// Shader clock extension
_SPIRV_OP(OpReadClockKHR)
#undef _SPIRV_OP
#define _SPIRV_OP(x, y) add(Op##y, #x);
......
......@@ -1726,6 +1726,7 @@ _SPIRV_OP(LifetimeStart, false, 3)
_SPIRV_OP(LifetimeStop, false, 3)
_SPIRV_OP(SelectionMerge, false, 3)
_SPIRV_OP(VectorTimesScalar, true, 5)
_SPIRV_OP(ReadClockKHR, true, 4)
#undef _SPIRV_OP
class SPIRVBallotInstBase : public SPIRVInstTemplateBase
......
......@@ -329,6 +329,8 @@ _SPIRV_OP(ModuleProcessed, 330)
//Ballot extension
_SPIRV_OP(SubgroupBallotKHR, 4421)
_SPIRV_OP(SubgroupFirstInvocationKHR, 4422)
// Shader clock extension
_SPIRV_OP(ReadClockKHR, 5055)
_SPIRV_OP(Forward, 1024) // Internal only
_SPIRV_OP(SubgroupShuffleINTEL, 5571)
_SPIRV_OP(SubgroupShuffleDownINTEL, 5572)
......
......@@ -7936,5 +7936,8 @@ void __builtin_spirv_OpenCL_prefetch_p1v8f64_i64(const global double8* p, ulong
void __builtin_spirv_OpenCL_prefetch_p1v16f64_i64(const global double16* p, ulong num_elements);
#endif // defined(cl_khr_fp64)
uint __builtin_spirv_OpReadClockKHR_i32(uint scope);
ulong __builtin_spirv_OpReadClockKHR_i64(uint scope);
#endif // __SPIRV_H__
......@@ -109,3 +109,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "IGCBiF_Math_64bitDiv.cl"
#endif
//*****************************************************************************/
// Read Clock Extension Opcodes
//*****************************************************************************/
#include "clock.cl"
/*===================== begin_copyright_notice ==================================
Copyright (c) 2017 Intel Corporation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
======================= end_copyright_notice ==================================*/
/* Shader clock extension */
__attribute__((always_inline))
ulong __builtin_spirv_OpReadClockKHR_i64(uint scope) {
(void) scope;
return as_ulong(__builtin_IB_read_cycle_counter());
}
__attribute__((always_inline))
uint __builtin_spirv_OpReadClockKHR_i32(uint scope) {
return (uint) __builtin_spirv_OpReadClockKHR_i64(scope);
}
......@@ -719,7 +719,7 @@ uint __get_pipe_max_packets(pipe int pipe_, uint bytes, uint alignment)
__attribute__((always_inline))
ulong OVERLOADABLE intel_get_cycle_counter( void )
{
return as_ulong(__builtin_IB_read_cycle_counter());
return __builtin_spirv_OpReadClockKHR_i64(0);
}
__attribute__((always_inline))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment