diff --git a/projects/hip/CMakeLists.txt b/projects/hip/CMakeLists.txt index 1c8f640afb..e405d06ed6 100644 --- a/projects/hip/CMakeLists.txt +++ b/projects/hip/CMakeLists.txt @@ -167,6 +167,7 @@ if(HIP_PLATFORM STREQUAL "hcc") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${HIP_HCC_BUILD_FLAGS}") set(SOURCE_FILES_RUNTIME + src/code_object_bundle.cpp src/hip_hcc.cpp src/hip_context.cpp src/hip_device.cpp @@ -179,7 +180,8 @@ if(HIP_PLATFORM STREQUAL "hcc") src/hip_db.cpp src/grid_launch.cpp src/hip_texture.cpp - src/env.cpp) + src/env.cpp + src/program_state.cpp) set(SOURCE_FILES_DEVICE src/device_util.cpp diff --git a/projects/hip/RELEASE.md b/projects/hip/RELEASE.md index 3987255f04..939ee48c86 100644 --- a/projects/hip/RELEASE.md +++ b/projects/hip/RELEASE.md @@ -8,6 +8,24 @@ We have attempted to document known bugs and limitations - in particular the [HI ## Revision History: +=================================================================================================== +Release: 1.5 +Date: +- Support threadIdx, blockIdx, blockDim directly (no need for hipify conversions in kernels.) HIP + Kernel syntax is now identical to CUDA kernel syntax - no need for extra parms or conversions. +- Refactor launch syntax. HIP now extracts kernels from the executable and launches them using the + existing module interface. Kernels dispatch no longer flows through HCC. Result is faster + kernel launches and with less resource usage (no signals required). +- Remove requirement for manual "serializers" previously required when passing complex structures + into kernels. +- Remove need for manual destructors +- Provide printf in device code +- Support for globals when using module API +- hipify-clang now supports using newer versions of clang +- HIP texture support equivalent to CUDA texture driver APIs +- Updates to hipify-perl, hipify-clang and documentation + + =================================================================================================== Release: 1.4 Date: 2017.10.06 @@ -23,7 +41,7 @@ Date: 2017.10.06 Release: 1.3 Date: 2017.08.16 - hipcc now auto-detects amdgcn arch. No need to specify the arch when building for same system. -- HIP texture support +- HIP texture support (run-time APIs) - Implemented __threadfence_support - Improvements in HIP context management logic - Bug fixes in several APIs including hipDeviceGetPCIBusId, hipEventDestroy, hipMemcpy2DAsync diff --git a/projects/hip/bin/hipconfig b/projects/hip/bin/hipconfig index cd8d36c5e7..2ff3c51d5e 100755 --- a/projects/hip/bin/hipconfig +++ b/projects/hip/bin/hipconfig @@ -1,7 +1,7 @@ #!/usr/bin/perl -w $HIP_BASE_VERSION_MAJOR = "1"; -$HIP_BASE_VERSION_MINOR = "4"; +$HIP_BASE_VERSION_MINOR = "5"; # Need perl > 5.10 to use logic-defined or use 5.006; use v5.10.1; diff --git a/projects/hip/bin/hipify-perl b/projects/hip/bin/hipify-perl index ada017abf4..65e3d26ee0 100755 --- a/projects/hip/bin/hipify-perl +++ b/projects/hip/bin/hipify-perl @@ -309,25 +309,6 @@ while (@ARGV) { $ft{'mem'} += s/\bcudaMallocPitch\b/hipMallocPitch/g; - #-------- - # Coordinate Indexing and Dimensions: - $ft{'coord_func'} += s/\bthreadIdx\.x\b/hipThreadIdx_x/g; - $ft{'coord_func'} += s/\bthreadIdx\.y\b/hipThreadIdx_y/g; - $ft{'coord_func'} += s/\bthreadIdx\.z\b/hipThreadIdx_z/g; - - $ft{'coord_func'} += s/\bblockIdx\.x\b/hipBlockIdx_x/g; - $ft{'coord_func'} += s/\bblockIdx\.y\b/hipBlockIdx_y/g; - $ft{'coord_func'} += s/\bblockIdx\.z\b/hipBlockIdx_z/g; - - $ft{'coord_func'} += s/\bblockDim\.x\b/hipBlockDim_x/g; - $ft{'coord_func'} += s/\bblockDim\.y\b/hipBlockDim_y/g; - $ft{'coord_func'} += s/\bblockDim\.z\b/hipBlockDim_z/g; - - $ft{'coord_func'} += s/\bgridDim\.x\b/hipGridDim_x/g; - $ft{'coord_func'} += s/\bgridDim\.y\b/hipGridDim_y/g; - $ft{'coord_func'} += s/\bgridDim\.z\b/hipGridDim_z/g; - - #-------- # Events $ft{'event'} += s/\bcudaEvent_t\b/hipEvent_t/g; diff --git a/projects/hip/docs/markdown/hip_bugs.md b/projects/hip/docs/markdown/hip_bugs.md index 78f0e53467..ef6fd5decb 100644 --- a/projects/hip/docs/markdown/hip_bugs.md +++ b/projects/hip/docs/markdown/hip_bugs.md @@ -2,7 +2,6 @@ -- [Errors related to undefined reference to `__hcLaunchKernel__***__grid_launch_parm**`](#errors-related-to-undefined-reference-to-__hclaunchkernel____grid_launch_parm) - [Can't find kernels inside dynamic linked library](#cant-find-kernels-inside-dynamic-linked-library) - [What is the current limitation of HIP Generic Grid Launch method?](#what-is-the-current-limitation-of-hip-generic-grid-launch-method) - [Errors related to `no matching constructor`](#errors-related-to-no-matching-constructor) @@ -10,139 +9,6 @@ -### Errors related to undefined reference to `__hcLaunchKernel__***__grid_launch_parm**` - -Some common code practices may lead to hipcc generating a error with the form : -``` -undefined reference to `__hcLaunchKernel__ZN15vecAddNamespace6vecAddIidEEv16grid_launch_parmPT0_S3_S3_T_ -``` -Or: -``` -error: weak declaration cannot have internal linkage -``` - -Suggested workarounds: -- Avoid use of static with kernel definition: -```c++ -static __global__ MyKernel -``` - -- Avoid defining kernels in anonymous namespace : -```c++ -namespace { - __global__ MyKernel -} -``` - -### Can't find kernels inside dynamic linked library - -HCC requires use of the "-Bdynamic" flag when creating a dynamic library which contains kernels. The dynamic flag causes the symbols to be created with a signature which allows HCC to discover and load the kernels in the dynamic library. This flag is often not set by default and must be added to the link step of the library. If not done, HCC will be unable to find the kernels defined in the library, and will emit a message such as: - -``` -HSADevice::CreateKernel(): Unable to create kernel" -``` - -To correct, add the following flag to hcc or hipcc: -``` -$ hipcc -Wl,-Bsymbolic ... -``` - -Ensure there is no space in the "Wl,-Bsymbolic" option. - - -### What is the current limitation of HIP Generic Grid Launch method? -1. __global__ functions cannot be marked as static or put in an unnamed namespace i.e. they cannot be given internal linkage (this would clash with __attribute__((weak))); -2. using the macro based dispatch mechanism i.e. hipLaunchKernel* only works for functions that take no more than 20 arguments (this limit can be increased up to 126, and is temporary until we can enable C++14 mode and use variadic generic lambdas); no such limitation applies do dispatching directly through grid_launch. - - -### Errors related to `no matching constructor` - -The symptom is the compiler would complain about errors like `no matching constructor` for classes/structs passed as arguments into a GPU kernel. Often, this is caused by a design limitation in HCC where array-typed member variables inside a class/struct can’t be correctly passed into GPU kernels. To mitigate this issue, a custom serializer/deserializer pair is provided. - -For example, `Foo` in the code snippets below contains an array-typed member variable `table`, which would fail the compiler if used as a kernel argument. - -``` -struct Foo { - float _data; - // table is an array, which makes foo - int table[3]; -}; -``` - -A workaround is to provide a custom serializer on host side which appends the contents of the array as kernel arguments, and a custome deserializaer on the device path to reconstruct the array inside the GPU kernels. -The deserializer can not be a function template, and should have scalar-typed parameters of the number equals to the length of the array-typed member variable. For example: - -``` - -struct Foo { - float _data; - int _table[3]; - - -#ifdef __HCC__ - // user-provided CPU serializer - // Append the contents of the array member as kernel arguments - __attribute__((annotate(“serialize”))) - void __cxxamp_serialize(Kalmar::Serialize &s) const { - s.Append(sizeof(float), &_data); - for (int i = 0; i < 3; ++i) - s.Append(sizeof(int), &_table[i]); - } - - - // user-provided GPU deserializer - // table has 3 int elements, so deserializer must have 3 int parameters. - __attribute__((annotate(“user_deserialize”))) - Foo(float d, int x0, int x1, int x2) [[cpu]][[hc]] { - _data = d; - _table[0] = x0; - _table[1] = x1; - _table[2] = x2; - } - -#endif -}; -``` - - -Rather than create serializer functions, another workaround is to pass the member fields from the structure as simple data types. -Note a class or struct can contain only one "user_deserialize" constructor. -For types which contain arrays which are based on template parameter, you can use partial template instantiation to implement one constructor per specialization. -However, an easier approach may be to create one user_deserializer which processes the maximum supported dimension. -This will take more memory in the structure and also require additional kernel arguments, but this may have little performance impact and the conversion is easier than partial template specialization. An example: - -``` -#define MAX_Dim 4 -template struct MyArray { - - T* dataPtr_; - //int size_[Dim]; // Original code with template-sized Dims - int size_[MAX_dim]; // Workaround code - allocate an array big enough for all dims so one serializer works. - - -... - -#ifdef __HCC__ - __attribute__((annotate("serialize"))) - void __cxxamp_serialize(Kalmar::Serialize &s) const { - s.Append(sizeof(float), &_dataPtr); - for (int i=0; i tex; + +__global__ void tex2dKernel(hipLaunchParm lp, float* outputData, + int width, + int height) +{ + int x = hipBlockIdx_x*hipBlockDim_x + hipThreadIdx_x; + int y = hipBlockIdx_y*hipBlockDim_y + hipThreadIdx_y; + outputData[y*width + x] = tex2D(tex, x, y); +} + +``` +``` +// Host code: + +texture tex; + +void myFunc () +{ + // ... + + textureReference* texref; + hipModuleGetTexRef(&texref, Module1, "tex"); + hipTexRefSetAddressMode(texref, 0, hipAddressModeWrap); + hipTexRefSetAddressMode(texref, 1, hipAddressModeWrap); + hipTexRefSetFilterMode(texref, hipFilterModePoint); + hipTexRefSetFlags(texref, 0); + hipTexRefSetFormat(texref, HIP_AD_FORMAT_FLOAT, 1); + hipTexRefSetArray(texref, array, HIP_TRSA_OVERRIDE_FORMAT); + + // ... +} +``` \ No newline at end of file diff --git a/projects/hip/docs/markdown/hip_porting_guide.md b/projects/hip/docs/markdown/hip_porting_guide.md index 12ec931f2a..aeb7b171d6 100644 --- a/projects/hip/docs/markdown/hip_porting_guide.md +++ b/projects/hip/docs/markdown/hip_porting_guide.md @@ -465,34 +465,36 @@ a performance impact. ### Textures and Cache Control ->Texture support is under-development and not yet supported by HIP. - Compute programs sometimes use textures either to access dedicated texture caches or to use the texture-sampling hardware for interpolation and clamping. The former approach uses simple point samplers with linear interpolation, essentially only reading a single point. The latter approach uses the sampler hardware to interpolate and combine multiple point samples. AMD hardware, as well as recent competing hardware, has a unified texture/L1 cache, so it no longer has a dedicated texture cache. But the nvcc path often caches global loads in the L2 cache, and some programs may benefit from explicit control of the L1 cache contents. We recommend the __ldg instruction for this purpose. -HIP currently lacks texture support; a future revision will add this capability. Also, AMD compilers currently load all data into both the L1 and L2 caches, so __ldg is treated as a no-op. +AMD compilers currently load all data into both the L1 and L2 caches, so __ldg is treated as a no-op. We recommend the following for functional portability: - For programs that use textures only to benefit from improved caching, use the __ldg instruction -- Alternatively, use conditional compilation (see [Identify HIP Target Platform](#identify-hip-target-platform)) - - For the `__HIP_PLATFORM_NVCC__` path, use the full texture path - - For the `__HIP_PLATFORM_HCC__` path, pass an additional pointer to the kernel and reference it using regular device memory-load instructions rather than texture loads. Some applications may already take this step, since it allows experimentation with caching behavior. +- Programs that use texture object APIs, work well on HIP +- For program that use texture reference APIs, use conditional compilation (see [Identify HIP Target Platform](#identify-hip-target-platform)) + - For the `__HIP_PLATFORM_HCC__` path, pass an additional argument to the kernel and in texture fetch API inside kernel as shown below:- ``` -texture t_features; +texture tex; -void __global__ MyKernel(float *d_features /* pass pointer parameter, if not already available */...) -{ - // ... - -#ifdef __HIP_PLATFORM_NVCC__ - float tval = tex1Dfetch(t_features,addr); -#else - float tval = d_features[addr]; +__global__ void tex2DKernel(float* outputData, +#ifdef __HIP_PLATFORM_HCC__ + hipTextureObject_t textureObject, +#endif + int width, + int height) +{ + int x = blockIdx.x*blockDim.x + threadIdx.x; + int y = blockIdx.y*blockDim.y + threadIdx.y; +#ifdef __HIP_PLATFORM_HCC__ + outputData[y*width + x] = tex2D(tex, textureObject, x, y); +#else + outputData[y*width + x] = tex2D(tex, x, y); #endif - } // Host code: @@ -500,23 +502,15 @@ void myFunc () { // ... -#ifdef __HIP_PLATFORM_NVCC__ - cudaChannelFormatDesc chDesc0 = cudaCreateChannelDesc(); - t_features.filterMode = cudaFilterModePoint; - t_features.normalized = false; - t_features.channelDesc = chDesc0; - - cudaBindTexture(NULL, &t_features, d_features, &chDesc0, npoints*nfeatures*sizeof(float)); +#ifdef __HIP_PLATFORM_HCC__ + hipLaunchKernelGGL(tex2DKernel, dim3(dimGrid), dim3(dimBlock), 0, 0, dData, tex.textureObject, width, height); +#else + hipLaunchKernelGGL(tex2DKernel, dim3(dimGrid), dim3(dimBlock), 0, 0, dData, width, height); #endif + ``` -Additionally, many of the Rodinia benchmarks demonstrate how to modify hipified programs so that textures are not required - search for USE_TEXTURES define in the rodinia source directory. -For example, [here - - -Cuda programs that employ sampler hardware must either wait for hcc texture support or use more-sophisticated workarounds. - ## More Tips ### HIPTRACE Mode diff --git a/projects/hip/include/hip/hcc_detail/code_object_bundle.hpp b/projects/hip/include/hip/hcc_detail/code_object_bundle.hpp new file mode 100644 index 0000000000..72f9d35c73 --- /dev/null +++ b/projects/hip/include/hip/hcc_detail/code_object_bundle.hpp @@ -0,0 +1,158 @@ +/* +Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. + +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. +*/ + +#pragma once + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace hip_impl +{ + hsa_isa_t triple_to_hsa_isa(const std::string& triple); + + struct Bundled_code { + union { + struct { + std::uint64_t offset; + std::uint64_t bundle_sz; + std::uint64_t triple_sz; + }; + std::uint8_t cbuf[ + sizeof(offset) + sizeof(bundle_sz) + sizeof(triple_sz)]; + }; + std::string triple; + std::vector blob; + }; + + class Bundled_code_header { + // DATA - STATICS + static constexpr const char magic_string_[] = + "__CLANG_OFFLOAD_BUNDLE__"; + static constexpr auto magic_string_sz_ = sizeof(magic_string_) - 1; + + // DATA + union { + struct { + std::uint8_t bundler_magic_string_[magic_string_sz_]; + std::uint64_t bundle_cnt_; + }; + std::uint8_t cbuf_[ + sizeof(bundler_magic_string_) + sizeof(bundle_cnt_)]; + }; + std::vector bundles_; + + // FRIENDS - MANIPULATORS + template + friend + inline + bool read( + RandomAccessIterator f, + RandomAccessIterator l, + Bundled_code_header& x) + { + if (f == l) return false; + + std::copy_n(f, sizeof(x.cbuf_), x.cbuf_); + + if (valid(x)) { + x.bundles_.resize(x.bundle_cnt_); + + auto it = f + sizeof(x.cbuf_); + for (auto&& y : x.bundles_) { + std::copy_n(it, sizeof(y.cbuf), y.cbuf); + it += sizeof(y.cbuf); + + y.triple.insert(y.triple.cend(), it, it + y.triple_sz); + + std::copy_n( + f + y.offset, y.bundle_sz, std::back_inserter(y.blob)); + + it += y.triple_sz; + } + + return true; + } + + return false; + } + friend + inline + bool read(const std::vector& blob, Bundled_code_header& x) + { + return read(blob.cbegin(), blob.cend(), x); + } + friend + inline + bool read(std::istream& is, Bundled_code_header& x) + { + return read(std::vector{ + std::istreambuf_iterator{is}, + std::istreambuf_iterator{}}, + x); + } + + // FRIENDS - ACCESSORS + friend + inline + bool valid(const Bundled_code_header& x) + { + return std::equal( + x.bundler_magic_string_, + x.bundler_magic_string_ + magic_string_sz_, + x.magic_string_); + } + friend + inline + const std::vector& bundles(const Bundled_code_header& x) + { + return x.bundles_; + } + public: + // CREATORS + Bundled_code_header() = default; + template + Bundled_code_header(RandomAccessIterator f, RandomAccessIterator l); + explicit + Bundled_code_header(const std::vector& blob); + Bundled_code_header(const Bundled_code_header&) = default; + Bundled_code_header(Bundled_code_header&&) = default; + ~Bundled_code_header() = default; + + // MANIPULATORS + Bundled_code_header& operator=(const Bundled_code_header&) = default; + Bundled_code_header& operator=(Bundled_code_header&&) = default; + }; + + // CREATORS + template + Bundled_code_header::Bundled_code_header(I f, I l) : Bundled_code_header{} + { + read(f, l, *this); + } +} // Namespace hip_impl. \ No newline at end of file diff --git a/projects/hip/include/hip/hcc_detail/concepts.hpp b/projects/hip/include/hip/hcc_detail/concepts.hpp index 5c50f5d577..18c1119b73 100644 --- a/projects/hip/include/hip/hcc_detail/concepts.hpp +++ b/projects/hip/include/hip/hcc_detail/concepts.hpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Copyright (c) 2015-present Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/hip/include/hip/hcc_detail/driver_types.h b/projects/hip/include/hip/hcc_detail/driver_types.h index ce5e9789be..5b31e3cd16 100644 --- a/projects/hip/include/hip/hcc_detail/driver_types.h +++ b/projects/hip/include/hip/hcc_detail/driver_types.h @@ -23,6 +23,7 @@ THE SOFTWARE. #ifndef HIP_INCLUDE_HIP_HCC_DETAIL_DRIVER_TYPES_H #define HIP_INCLUDE_HIP_HCC_DETAIL_DRIVER_TYPES_H +typedef void* hipDeviceptr_t; enum hipChannelFormatKind { hipChannelFormatKindSigned = 0, @@ -40,6 +41,29 @@ struct hipChannelFormatDesc enum hipChannelFormatKind f; }; +#define HIP_TRSF_NORMALIZED_COORDINATES 0x02 +#define HIP_TRSF_READ_AS_INTEGER 0x01 +#define HIP_TRSA_OVERRIDE_FORMAT 0x01 + +enum hipArray_Format +{ + HIP_AD_FORMAT_UNSIGNED_INT8 = 0x01, + HIP_AD_FORMAT_UNSIGNED_INT16 = 0x02, + HIP_AD_FORMAT_UNSIGNED_INT32 = 0x03, + HIP_AD_FORMAT_SIGNED_INT8 = 0x08, + HIP_AD_FORMAT_SIGNED_INT16 = 0x09, + HIP_AD_FORMAT_SIGNED_INT32 = 0x0a, + HIP_AD_FORMAT_HALF = 0x10, + HIP_AD_FORMAT_FLOAT = 0x20 +}; + +struct HIP_ARRAY_DESCRIPTOR { + enum hipArray_Format format; + unsigned int numChannels; + size_t width; + size_t height; +}; + struct hipArray { void* data; //FIXME: generalize this struct hipChannelFormatDesc desc; @@ -47,8 +71,30 @@ struct hipArray { unsigned int width; unsigned int height; unsigned int depth; + struct HIP_ARRAY_DESCRIPTOR drvDesc; + bool isDrv; }; +typedef struct hip_Memcpy2D { + size_t height; + size_t widthInBytes; + hipArray* dstArray; + hipDeviceptr_t dstDevice; + void * dstHost; + hipMemoryType dstMemoryType; + size_t dstPitch; + size_t dstXInBytes; + size_t dstY; + hipArray* srcArray; + hipDeviceptr_t srcDevice; + const void * srcHost; + hipMemoryType srcMemoryType; + size_t srcPitch; + size_t srcXInBytes; + size_t srcY; +}hip_Memcpy2D; + + typedef struct hipArray* hipArray_t; typedef const struct hipArray* hipArray_const_t; diff --git a/projects/hip/include/hip/hcc_detail/functional_grid_launch.hpp b/projects/hip/include/hip/hcc_detail/functional_grid_launch.hpp new file mode 100644 index 0000000000..bbffae52e8 --- /dev/null +++ b/projects/hip/include/hip/hcc_detail/functional_grid_launch.hpp @@ -0,0 +1,159 @@ +/* +Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. + +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. +*/ + +#pragma once + +#include "code_object_bundle.hpp" +#include "concepts.hpp" +#include "helpers.hpp" +#include "program_state.hpp" + +#include "hc.hpp" +#include "hip/hip_hcc.h" +#include "hip_runtime.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace hip_impl +{ + template< + typename T, + typename std::enable_if{}>::type* = nullptr> + inline + T round_up_to_next_multiple_nonnegative(T x, T y) + { + T tmp = x + y - 1; + return tmp - tmp % y; + } + + inline + std::vector make_kernarg() + { + return {}; + } + + inline + std::vector make_kernarg(std::vector kernarg) + { + return kernarg; + } + + template + inline + std::vector make_kernarg(std::vector kernarg, T x) + { + kernarg.resize( + round_up_to_next_multiple_nonnegative(kernarg.size(), alignof(T)) + + sizeof(T)); + + new (kernarg.data() + kernarg.size() - sizeof(T)) T{std::move(x)}; + + return kernarg; + } + + template + inline + std::vector make_kernarg( + std::vector kernarg, T x, Ts... xs) + { + return make_kernarg( + make_kernarg(std::move(kernarg), std::move(x)), std::move(xs)...); + } + + template + inline + std::vector make_kernarg(Ts... xs) + { + std::vector kernarg; + kernarg.reserve(sizeof(std::tuple)); + + return make_kernarg(std::move(kernarg), std::move(xs)...); + } + + void hipLaunchKernelGGLImpl( + std::uintptr_t function_address, + const dim3& numBlocks, + const dim3& dimBlocks, + std::uint32_t sharedMemBytes, + hipStream_t stream, + void** kernarg); +} // Namespace hip_impl. + +template +inline +void hipLaunchKernelGGL( + F kernel, + const dim3& numBlocks, + const dim3& dimBlocks, + std::uint32_t sharedMemBytes, + hipStream_t stream, + Args... args) +{ + auto kernarg = hip_impl::make_kernarg(std::move(args)...); + std::size_t kernarg_size = kernarg.size(); + + void* config[] = { + HIP_LAUNCH_PARAM_BUFFER_POINTER, kernarg.data(), + HIP_LAUNCH_PARAM_BUFFER_SIZE, &kernarg_size, + HIP_LAUNCH_PARAM_END + }; + + hip_impl::hipLaunchKernelGGLImpl( + reinterpret_cast(kernel), + numBlocks, + dimBlocks, + sharedMemBytes, + stream, + &config[0]); +} + +template +inline +void hipLaunchKernel( + F kernel, + const dim3& numBlocks, + const dim3& dimBlocks, + std::uint32_t groupMemBytes, + hipStream_t stream, + Args... args) +{ + hipLaunchKernelGGL( + kernel, + numBlocks, + dimBlocks, + groupMemBytes, + stream, + hipLaunchParm{}, + std::move(args)...); +} + diff --git a/projects/hip/include/hip/hcc_detail/grid_launch_GGL.hpp b/projects/hip/include/hip/hcc_detail/grid_launch_GGL.hpp index 4c632f9d68..95903436b6 100644 --- a/projects/hip/include/hip/hcc_detail/grid_launch_GGL.hpp +++ b/projects/hip/include/hip/hcc_detail/grid_launch_GGL.hpp @@ -19,989 +19,12 @@ 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. */ - #pragma once #if GENERIC_GRID_LAUNCH == 1 - -#include "concepts.hpp" -#include "helpers.hpp" - -#include "hc.hpp" -#include "hip/hip_hcc.h" -#include "hip_runtime.h" - -#include -#include -#include -#include -#include - -namespace hip_impl -{ - namespace - { - struct New_grid_launch_tag {}; - struct Old_grid_launch_tag {}; - - template - class RAII_guard { - D dtor_; - public: - RAII_guard() = default; - - RAII_guard(const C& ctor, D dtor) : dtor_{std::move(dtor)} - { - ctor(); - } - - RAII_guard(const RAII_guard&) = default; - RAII_guard(RAII_guard&&) = default; - - RAII_guard& operator=(const RAII_guard&) = default; - RAII_guard& operator=(RAII_guard&&) = default; - - ~RAII_guard() { dtor_(); } - }; - - template - RAII_guard make_RAII_guard(const C& ctor, D dtor) - { - return RAII_guard{ctor, std::move(dtor)}; - } - - template - using is_new_grid_launch_t = typename std::conditional< - is_callable{}, - New_grid_launch_tag, - Old_grid_launch_tag>::type; - } - - // TODO: - dispatch rank should be derived from the domain dimensions passed - // in, and not always assumed to be 3; - - template - requires(Domain == {Ts...}) - inline - void grid_launch_hip_impl_( - New_grid_launch_tag, - dim3 num_blocks, - dim3 dim_blocks, - int group_mem_bytes, - const hc::accelerator_view& acc_v, - K k) - { - const auto d = hc::extent<3>{ - num_blocks.z * dim_blocks.z, - num_blocks.y * dim_blocks.y, - num_blocks.x * dim_blocks.x}.tile_with_dynamic( - dim_blocks.z, - dim_blocks.y, - dim_blocks.x, - group_mem_bytes); - - try { - hc::parallel_for_each(acc_v, d, k); - } - catch (std::exception& ex) { - std::cerr << "Failed in " << __func__ << ", with exception: " - << ex.what() << std::endl; - throw; - } - } - - // TODO: these are workarounds, they should be removed. - - hc::accelerator_view lock_stream_hip_(hipStream_t&, void*&); - void print_prelaunch_trace_(const char*, dim3, dim3, int, hipStream_t); - void unlock_stream_hip_( - hipStream_t, void*, const char*, hc::accelerator_view*); - - template - requires(Domain == {Ts...}) - inline - void grid_launch_hip_impl_( - New_grid_launch_tag, - dim3 num_blocks, - dim3 dim_blocks, - int group_mem_bytes, - hipStream_t stream, - const char* kernel_name, - K k) - { - void* lck_stream = nullptr; - auto acc_v = lock_stream_hip_(stream, lck_stream); - auto stream_guard = make_RAII_guard( - std::bind( - print_prelaunch_trace_, - kernel_name, - num_blocks, - dim_blocks, - group_mem_bytes, - stream), - std::bind( - unlock_stream_hip_, stream, lck_stream, kernel_name, &acc_v)); - - try { - grid_launch_hip_impl_( - New_grid_launch_tag{}, - std::move(num_blocks), - std::move(dim_blocks), - group_mem_bytes, - acc_v, - std::move(k)); - } - catch (std::exception& ex) { - std::cerr << "Failed in " << __func__ << ", with exception: " - << ex.what() << std::endl; - throw; - } - } - - template - requires(Domain == {hipLaunchParm, Ts...}) - inline - void grid_launch_hip_impl_( - Old_grid_launch_tag, - dim3 num_blocks, - dim3 dim_blocks, - int group_mem_bytes, - hipStream_t stream, - K k) - { - grid_launch_hip_impl_( - New_grid_launch_tag{}, - std::move(num_blocks), - std::move(dim_blocks), - group_mem_bytes, - std::move(stream), - std::move(k)); - } - - template - requires(Domain == {hipLaunchParm, Ts...}) - inline - void grid_launch_hip_impl_( - Old_grid_launch_tag, - dim3 num_blocks, - dim3 dim_blocks, - int group_mem_bytes, - hipStream_t stream, - const char* kernel_name, - K k) - { - grid_launch_hip_impl_( - New_grid_launch_tag{}, - std::move(num_blocks), - std::move(dim_blocks), - group_mem_bytes, - std::move(stream), - kernel_name, - std::move(k)); - } - - template - requires(Domain == {Ts...}) - inline - std::enable_if_t::value> grid_launch_hip_( - dim3 num_blocks, - dim3 dim_blocks, - int group_mem_bytes, - hipStream_t stream, - const char* kernel_name, - K k) - { - grid_launch_hip_impl_( - is_new_grid_launch_t{}, - std::move(num_blocks), - std::move(dim_blocks), - group_mem_bytes, - std::move(stream), - kernel_name, - std::move(k)); - } - - template - requires(Domain == {Ts...}) - inline - std::enable_if_t::value> grid_launch_hip_( - dim3 num_blocks, - dim3 dim_blocks, - int group_mem_bytes, - hipStream_t stream, - K k) - { - grid_launch_hip_impl_( - is_new_grid_launch_t{}, - std::move(num_blocks), - std::move(dim_blocks), - group_mem_bytes, - std::move(stream), - std::move(k)); - } - - // TODO: these are temporary and purposefully noisy and disruptive. - #define make_kernel_name_hip(k, n)\ - HIP_kernel_functor_name_begin ## _ ## k ## _ ## \ - HIP_kernel_functor_name_end ## _ ## n - - #define make_kernel_functor_hip_30(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23,\ - p24, p25, p26, p27)\ - struct make_kernel_name_hip(function_name, 28) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - std::decay_t _p16_;\ - std::decay_t _p17_;\ - std::decay_t _p18_;\ - std::decay_t _p19_;\ - std::decay_t _p20_;\ - std::decay_t _p21_;\ - std::decay_t _p22_;\ - std::decay_t _p23_;\ - std::decay_t _p24_;\ - std::decay_t _p25_;\ - std::decay_t _p26_;\ - std::decay_t _p27_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ - _p18_, _p19_, _p20_, _p21_, _p22_, _p23_, _p24_, _p25_,\ - _p26_, _p27_);\ - }\ - } - #define make_kernel_functor_hip_29(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23,\ - p24, p25, p26)\ - struct make_kernel_name_hip(function_name, 27) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - std::decay_t _p16_;\ - std::decay_t _p17_;\ - std::decay_t _p18_;\ - std::decay_t _p19_;\ - std::decay_t _p20_;\ - std::decay_t _p21_;\ - std::decay_t _p22_;\ - std::decay_t _p23_;\ - std::decay_t _p24_;\ - std::decay_t _p25_;\ - std::decay_t _p26_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ - _p18_, _p19_, _p20_, _p21_, _p22_, _p23_, _p24_, _p25_,\ - _p26_);\ - }\ - } - #define make_kernel_functor_hip_28(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23,\ - p24, p25)\ - struct make_kernel_name_hip(function_name, 26) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - std::decay_t _p16_;\ - std::decay_t _p17_;\ - std::decay_t _p18_;\ - std::decay_t _p19_;\ - std::decay_t _p20_;\ - std::decay_t _p21_;\ - std::decay_t _p22_;\ - std::decay_t _p23_;\ - std::decay_t _p24_;\ - std::decay_t _p25_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ - _p18_, _p19_, _p20_, _p21_, _p22_, _p23_, _p24_, _p25_);\ - }\ - } - #define make_kernel_functor_hip_27(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23,\ - p24)\ - struct make_kernel_name_hip(function_name, 25) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - std::decay_t _p16_;\ - std::decay_t _p17_;\ - std::decay_t _p18_;\ - std::decay_t _p19_;\ - std::decay_t _p20_;\ - std::decay_t _p21_;\ - std::decay_t _p22_;\ - std::decay_t _p23_;\ - std::decay_t _p24_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ - _p18_, _p19_, _p20_, _p21_, _p22_, _p23_, _p24_);\ - }\ - } - #define make_kernel_functor_hip_26(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23)\ - struct make_kernel_name_hip(function_name, 24) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - std::decay_t _p16_;\ - std::decay_t _p17_;\ - std::decay_t _p18_;\ - std::decay_t _p19_;\ - std::decay_t _p20_;\ - std::decay_t _p21_;\ - std::decay_t _p22_;\ - std::decay_t _p23_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ - _p18_, _p19_, _p20_, _p21_, _p22_, _p23_);\ - }\ - } - #define make_kernel_functor_hip_25(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22)\ - struct make_kernel_name_hip(function_name, 23) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - std::decay_t _p16_;\ - std::decay_t _p17_;\ - std::decay_t _p18_;\ - std::decay_t _p19_;\ - std::decay_t _p20_;\ - std::decay_t _p21_;\ - std::decay_t _p22_;\ - __attribute__((used, flatten))\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ - _p18_, _p19_, _p20_, _p21_, _p22_);\ - }\ - } - #define make_kernel_functor_hip_24(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21)\ - struct make_kernel_name_hip(function_name, 22) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - std::decay_t _p16_;\ - std::decay_t _p17_;\ - std::decay_t _p18_;\ - std::decay_t _p19_;\ - std::decay_t _p20_;\ - std::decay_t _p21_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ - _p18_, _p19_, _p20_, _p21_);\ - }\ - } - #define make_kernel_functor_hip_23(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20)\ - struct make_kernel_name_hip(function_name, 21) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - std::decay_t _p16_;\ - std::decay_t _p17_;\ - std::decay_t _p18_;\ - std::decay_t _p19_;\ - std::decay_t _p20_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ - _p18_, _p19_, _p20_);\ - }\ - } - #define make_kernel_functor_hip_22(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15, p16, p17, p18, p19)\ - struct make_kernel_name_hip(function_name, 20) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - std::decay_t _p16_;\ - std::decay_t _p17_;\ - std::decay_t _p18_;\ - std::decay_t _p19_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ - _p18_, _p19_);\ - }\ - } - #define make_kernel_functor_hip_21(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15, p16, p17, p18)\ - struct make_kernel_name_hip(function_name, 19) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - std::decay_t _p16_;\ - std::decay_t _p17_;\ - std::decay_t _p18_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ - _p18_);\ - }\ - } - #define make_kernel_functor_hip_20(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15, p16, p17)\ - struct make_kernel_name_hip(function_name, 18) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - std::decay_t _p16_;\ - std::decay_t _p17_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_);\ - }\ - } - #define make_kernel_functor_hip_19(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15, p16)\ - struct make_kernel_name_hip(function_name, 17) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - std::decay_t _p16_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_);\ - }\ - } - #define make_kernel_functor_hip_18(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14, p15)\ - struct make_kernel_name_hip(function_name, 16) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - std::decay_t _p15_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_, _p15_);\ - }\ - } - #define make_kernel_functor_hip_17(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13, p14)\ - struct make_kernel_name_hip(function_name, 15) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - std::decay_t _p14_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_, _p14_);\ - }\ - } - #define make_kernel_functor_hip_16(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12, p13)\ - struct make_kernel_name_hip(function_name, 14) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - std::decay_t _p13_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_, _p13_);\ - }\ - } - #define make_kernel_functor_hip_15(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11, p12)\ - struct make_kernel_name_hip(function_name, 13) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - std::decay_t _p12_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_, _p12_);\ - }\ - } - #define make_kernel_functor_hip_14(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ - p10, p11)\ - struct make_kernel_name_hip(function_name, 12) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - std::decay_t _p11_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_, _p11_);\ - }\ - } - #define make_kernel_functor_hip_13(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)\ - struct make_kernel_name_hip(function_name, 11) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - std::decay_t _p10_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ - _p10_);\ - }\ - } - #define make_kernel_functor_hip_12(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\ - struct make_kernel_name_hip(function_name, 10) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - std::decay_t _p9_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_,\ - _p9_);\ - }\ - } - #define make_kernel_functor_hip_11(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\ - struct make_kernel_name_hip(function_name, 9) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - std::decay_t _p8_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(\ - _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_);\ - }\ - } - #define make_kernel_functor_hip_10(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7)\ - struct make_kernel_name_hip(function_name, 8) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - std::decay_t _p7_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(_p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_);\ - }\ - } - #define make_kernel_functor_hip_9(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6)\ - struct make_kernel_name_hip(function_name, 7) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - std::decay_t _p6_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(_p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_);\ - }\ - } - #define make_kernel_functor_hip_8(\ - function_name, kernel_name, p0, p1, p2, p3, p4, p5)\ - struct make_kernel_name_hip(function_name, 6) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - std::decay_t _p5_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(_p0_, _p1_, _p2_, _p3_, _p4_, _p5_);\ - }\ - } - #define make_kernel_functor_hip_7(\ - function_name, kernel_name, p0, p1, p2, p3, p4)\ - struct make_kernel_name_hip(function_name, 5) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - std::decay_t _p4_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(_p0_, _p1_, _p2_, _p3_, _p4_);\ - }\ - } - #define make_kernel_functor_hip_6(function_name, kernel_name, p0, p1, p2, p3)\ - struct make_kernel_name_hip(function_name, 4) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - std::decay_t _p3_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(_p0_, _p1_, _p2_, _p3_);\ - }\ - } - #define make_kernel_functor_hip_5(function_name, kernel_name, p0, p1, p2)\ - struct make_kernel_name_hip(function_name, 3) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - std::decay_t _p2_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(_p0_, _p1_, _p2_);\ - }\ - } - #define make_kernel_functor_hip_4(function_name, kernel_name, p0, p1)\ - struct make_kernel_name_hip(function_name, 2) {\ - std::decay_t _p0_;\ - std::decay_t _p1_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(_p0_, _p1_);\ - }\ - } - #define fofo(f, n) kernel_prefix_hip ## f ## kernel_suffix_hip ## n - #define make_kernel_functor_hip_3(function_name, kernel_name, p0)\ - struct make_kernel_name_hip(function_name, 1) {\ - std::decay_t _p0_;\ - void operator()(const hc::tiled_index<3>&) const [[hc]]\ - {\ - kernel_name(_p0_);\ - }\ - } - #define make_kernel_functor_hip_2(function_name, kernel_name)\ - struct make_kernel_name_hip(function_name, 0) {\ - void operator()(const hc::tiled_index<3>&) [[hc]]\ - {\ - return kernel_name(hipLaunchParm{});\ - }\ - } - #define make_kernel_functor_hip_1(...) - #define make_kernel_functor_hip_0(...) - #define make_kernel_functor_hip_(...)\ - overload_macro_hip_(make_kernel_functor_hip_, __VA_ARGS__) - - - #define hipLaunchNamedKernelGGL(\ - function_name,\ - kernel_name,\ - num_blocks,\ - dim_blocks,\ - group_mem_bytes,\ - stream,\ - ...)\ - do {\ - make_kernel_functor_hip_(function_name, kernel_name, __VA_ARGS__)\ - hip_kernel_functor_impl_{__VA_ARGS__};\ - hip_impl::grid_launch_hip_(\ - num_blocks,\ - dim_blocks,\ - group_mem_bytes,\ - stream,\ - #kernel_name,\ - hip_kernel_functor_impl_);\ - } while(0) - - #define hipLaunchKernelGGL(\ - kernel_name, num_blocks, dim_blocks, group_mem_bytes, stream, ...)\ - do {\ - hipLaunchNamedKernelGGL(\ - unnamed,\ - kernel_name,\ - num_blocks,\ - dim_blocks,\ - group_mem_bytes,\ - stream,\ - ##__VA_ARGS__);\ - } while (0) - - #define hipLaunchKernel(\ - kernel_name, num_blocks, dim_blocks, group_mem_bytes, stream, ...)\ - do {\ - hipLaunchKernelGGL(\ - kernel_name,\ - num_blocks,\ - dim_blocks,\ - group_mem_bytes,\ - stream,\ - hipLaunchParm{},\ - ##__VA_ARGS__);\ - } while(0) -} -#endif //GENERIC_GRID_LAUNCH + #if __hcc_workweek__ >= 17481 + #include "functional_grid_launch.hpp" + #else + #include "macro_based_grid_launch.hpp" + #endif +#endif //GENERIC_GRID_LAUNCH \ No newline at end of file diff --git a/projects/hip/include/hip/hcc_detail/hip_runtime_api.h b/projects/hip/include/hip/hcc_detail/hip_runtime_api.h index 03be587b0d..16f13ebee2 100644 --- a/projects/hip/include/hip/hcc_detail/hip_runtime_api.h +++ b/projects/hip/include/hip/hcc_detail/hip_runtime_api.h @@ -84,8 +84,6 @@ typedef struct ihipModule_t *hipModule_t; typedef struct ihipModuleSymbol_t *hipFunction_t; -typedef void* hipDeviceptr_t; - typedef struct ihipEvent_t *hipEvent_t; enum hipLimit_t @@ -621,7 +619,7 @@ hipError_t hipStreamQuery(hipStream_t stream); * * This command is host-synchronous : the host will block until the specified stream is empty. * - * This command follows standard null-stream semantics. Specifically, specifying the null stream will cause the + * This command follows standard null-stream semantics. Specifically, specifying the null stream will cause the * command to wait for other streams on the same device to complete all pending operations. * * This command honors the hipDeviceLaunchBlocking flag, which controls whether the wait is active or blocking. @@ -644,9 +642,9 @@ hipError_t hipStreamSynchronize(hipStream_t stream); * This function inserts a wait operation into the specified stream. * All future work submitted to @p stream will wait until @p event reports completion before beginning execution. * - * This function only waits for commands in the current stream to complete. Notably,, this function does - * not impliciy wait for commands in the default stream to complete, even if the specified stream is - * created with hipStreamNonBlocking = 0. + * This function only waits for commands in the current stream to complete. Notably,, this function does + * not impliciy wait for commands in the default stream to complete, even if the specified stream is + * created with hipStreamNonBlocking = 0. * * @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamSynchronize, hipStreamDestroy */ @@ -756,7 +754,7 @@ hipError_t hipEventCreate(hipEvent_t* event); * If hipEventRecord() has been previously called on this event, then this call will overwrite any existing state in event. * * If this function is called on a an event that is currently being recorded, results are undefined - either - * outstanding recording may save state into the event, and the order is not guaranteed. + * outstanding recording may save state into the event, and the order is not guaranteed. * * @see hipEventCreate, hipEventCreateWithFlags, hipEventQuery, hipEventSynchronize, hipEventDestroy, hipEventElapsedTime * @@ -1318,6 +1316,7 @@ hipError_t hipMallocArray(hipArray** array, const hipChannelFormatDesc* desc, hipError_t hipMallocArray(hipArray** array, const struct hipChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags); #endif +hipError_t hipArrayCreate ( hipArray** pHandle, const HIP_ARRAY_DESCRIPTOR* pAllocateArray ); /** * @brief Frees an array on the device. * @@ -1359,6 +1358,7 @@ hipError_t hipMalloc3DArray(hipArray_t *array, * @see hipMemcpy, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray, hipMemcpyToSymbol, hipMemcpyAsync */ hipError_t hipMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, hipMemcpyKind kind); +hipError_t hipMemcpyParam2D(const hip_Memcpy2D* pCopy); /** * @brief Copies data between host and device. @@ -1968,6 +1968,7 @@ hipError_t hipModuleGetFunction(hipFunction_t *function, hipModule_t module, con */ hipError_t hipModuleGetGlobal(hipDeviceptr_t *dptr, size_t *bytes, hipModule_t hmod, const char *name); +hipError_t hipModuleGetTexRef(textureReference** texRef, hipModule_t hmod, const char* name); /** * @brief builds module from code object which resides in host memory. Image is pointer to that location. * @@ -2172,12 +2173,9 @@ hipError_t ihipBindTextureImpl(int dim, enum hipTextureReadMode readMode, size_t *offset, const void *devPtr, - const struct hipChannelFormatDesc& desc, + const struct hipChannelFormatDesc* desc, size_t size, - enum hipTextureAddressMode addressMode, - enum hipTextureFilterMode filterMode, - int normalizedCoords, - hipTextureObject_t& textureObject); + textureReference* tex); /* * @brief hipBindTexture Binds size bytes of the memory area pointed to by @p devPtr to the texture reference tex. @@ -2199,9 +2197,7 @@ hipError_t hipBindTexture(size_t *offset, const struct hipChannelFormatDesc& desc, size_t size = UINT_MAX) { - return ihipBindTextureImpl(dim, readMode, offset, devPtr, desc, size, - tex.addressMode[0], tex.filterMode, tex.normalized, - tex.textureObject); + return ihipBindTextureImpl(dim, readMode, offset, devPtr, &desc, size, &tex); } /* @@ -2222,9 +2218,7 @@ hipError_t hipBindTexture(size_t *offset, const void *devPtr, size_t size = UINT_MAX) { - return ihipBindTextureImpl(dim, readMode, offset, devPtr, tex.channelDesc, size, - tex.addressMode[0], tex.filterMode, tex.normalized, - tex.textureObject); + return ihipBindTextureImpl(dim, readMode, offset, devPtr, &(tex.channelDesc), size, &tex); } // C API @@ -2240,13 +2234,10 @@ hipError_t ihipBindTexture2DImpl(int dim, enum hipTextureReadMode readMode, size_t *offset, const void *devPtr, - const struct hipChannelFormatDesc& desc, + const struct hipChannelFormatDesc* desc, size_t width, size_t height, - enum hipTextureAddressMode addressMode, - enum hipTextureFilterMode filterMode, - int normalizedCoords, - hipTextureObject_t& textureObject); + textureReference* tex); template hipError_t hipBindTexture2D(size_t *offset, @@ -2256,9 +2247,7 @@ hipError_t hipBindTexture2D(size_t *offset, size_t height, size_t pitch) { - return ihipBindTexture2DImpl(dim, readMode, offset, devPtr, tex.channelDesc, width, height, - tex.addressMode[0], tex.filterMode, tex.normalized, - tex.textureObject); + return ihipBindTexture2DImpl(dim, readMode, offset, devPtr, &(tex.channelDesc), width, height, &tex); } template @@ -2270,9 +2259,7 @@ hipError_t hipBindTexture2D(size_t *offset, size_t height, size_t pitch) { - return ihipBindTexture2DImpl(dim, readMode, offset, devPtr, desc, width, height, - tex.addressMode[0], tex.filterMode, tex.normalized, - tex.textureObject); + return ihipBindTexture2DImpl(dim, readMode, offset, devPtr, &desc, width, height, &tex); } //C API @@ -2284,18 +2271,13 @@ hipError_t ihipBindTextureToArrayImpl(int dim, enum hipTextureReadMode readMode, hipArray_const_t array, const struct hipChannelFormatDesc& desc, - enum hipTextureAddressMode addressMode, - enum hipTextureFilterMode filterMode, - int normalizedCoords, - hipTextureObject_t& textureObject); + textureReference* tex); template hipError_t hipBindTextureToArray(struct texture& tex, hipArray_const_t array) { - return ihipBindTextureToArrayImpl(dim, readMode, array, tex.channelDesc, - tex.addressMode[0], tex.filterMode, tex.normalized, - tex.textureObject); + return ihipBindTextureToArrayImpl(dim, readMode, array, tex.channelDesc, &tex); } template @@ -2303,9 +2285,7 @@ hipError_t hipBindTextureToArray(struct texture& tex, hipArray_const_t array, const struct hipChannelFormatDesc& desc) { - return ihipBindTextureToArrayImpl(dim, readMode, array, desc, - tex.addressMode[0], tex.filterMode, tex.normalized, - tex.textureObject); + return ihipBindTextureToArrayImpl(dim, readMode, array, desc, &tex); } //C API @@ -2359,6 +2339,19 @@ hipError_t hipDestroyTextureObject(hipTextureObject_t textureObject); hipError_t hipGetTextureObjectResourceDesc(hipResourceDesc* pResDesc, hipTextureObject_t textureObject); hipError_t hipGetTextureObjectResourceViewDesc(hipResourceViewDesc* pResViewDesc, hipTextureObject_t textureObject); hipError_t hipGetTextureObjectTextureDesc(hipTextureDesc* pTexDesc, hipTextureObject_t textureObject); +hipError_t hipTexRefSetArray ( textureReference* tex, hipArray_const_t array, unsigned int flags ); + +hipError_t hipTexRefSetAddressMode ( textureReference* tex, int dim, hipTextureAddressMode am ); + +hipError_t hipTexRefSetFilterMode ( textureReference* tex, hipTextureFilterMode fm ); + +hipError_t hipTexRefSetFlags ( textureReference* tex, unsigned int flags ); + +hipError_t hipTexRefSetFormat (textureReference* tex, hipArray_Format fmt, int NumPackedComponents ); + +hipError_t hipTexRefSetAddress( size_t* offset, textureReference* tex, hipDeviceptr_t devPtr, size_t size ); + +hipError_t hipTexRefSetAddress2D( textureReference* tex, const HIP_ARRAY_DESCRIPTOR* desc, hipDeviceptr_t devPtr, size_t pitch ); // doxygen end Texture /** diff --git a/projects/hip/include/hip/hcc_detail/host_defines.h b/projects/hip/include/hip/hcc_detail/host_defines.h index b2e7ac2617..a7acdfccf7 100644 --- a/projects/hip/include/hip/hcc_detail/host_defines.h +++ b/projects/hip/include/hip/hcc_detail/host_defines.h @@ -44,7 +44,12 @@ THE SOFTWARE. #if GENERIC_GRID_LAUNCH == 0 #define __global__ __attribute__((hc_grid_launch)) __attribute__((used)) #else -#define __global__ __attribute__((annotate("hip__global__"), hc, used, weak)) + #if __hcc_workweek__ >= 17481 + #define __global__ \ + __attribute__((annotate("__HIP_global_function__"), cpu, hc, used)) + #else + #define __global__ __attribute__((hc, used)) + #endif #endif //GENERIC_GRID_LAUNCH #define __noinline__ __attribute__((noinline)) diff --git a/projects/hip/include/hip/hcc_detail/macro_based_grid_launch.hpp b/projects/hip/include/hip/hcc_detail/macro_based_grid_launch.hpp new file mode 100644 index 0000000000..f1dfe76245 --- /dev/null +++ b/projects/hip/include/hip/hcc_detail/macro_based_grid_launch.hpp @@ -0,0 +1,1004 @@ +/* +Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. + +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. +*/ + +#pragma once + +#include "concepts.hpp" +#include "helpers.hpp" + +#include "hc.hpp" +#include "hip/hip_hcc.h" +#include "hip_runtime.h" + +#include +#include +#include +#include +#include + +namespace hip_impl +{ + namespace + { + struct New_grid_launch_tag {}; + struct Old_grid_launch_tag {}; + + template + class RAII_guard { + D dtor_; + public: + RAII_guard() = default; + + RAII_guard(const C& ctor, D dtor) : dtor_{std::move(dtor)} + { + ctor(); + } + + RAII_guard(const RAII_guard&) = default; + RAII_guard(RAII_guard&&) = default; + + RAII_guard& operator=(const RAII_guard&) = default; + RAII_guard& operator=(RAII_guard&&) = default; + + ~RAII_guard() { dtor_(); } + }; + + template + RAII_guard make_RAII_guard(const C& ctor, D dtor) + { + return RAII_guard{ctor, std::move(dtor)}; + } + + template + using is_new_grid_launch_t = typename std::conditional< + is_callable{}, + New_grid_launch_tag, + Old_grid_launch_tag>::type; + } + + // TODO: - dispatch rank should be derived from the domain dimensions passed + // in, and not always assumed to be 3; + + template + requires(Domain == {Ts...}) + inline + void grid_launch_hip_impl_( + New_grid_launch_tag, + dim3 num_blocks, + dim3 dim_blocks, + int group_mem_bytes, + const hc::accelerator_view& acc_v, + K k) + { + const auto d = hc::extent<3>{ + num_blocks.z * dim_blocks.z, + num_blocks.y * dim_blocks.y, + num_blocks.x * dim_blocks.x}.tile_with_dynamic( + dim_blocks.z, + dim_blocks.y, + dim_blocks.x, + group_mem_bytes); + + try { + hc::parallel_for_each(acc_v, d, k); + } + catch (std::exception& ex) { + std::cerr << "Failed in " << __func__ << ", with exception: " + << ex.what() << std::endl; + throw; + } + } + + // TODO: these are workarounds, they should be removed. + + hc::accelerator_view lock_stream_hip_(hipStream_t&, void*&); + void print_prelaunch_trace_(const char*, dim3, dim3, int, hipStream_t); + void unlock_stream_hip_( + hipStream_t, void*, const char*, hc::accelerator_view*); + + template + requires(Domain == {Ts...}) + inline + void grid_launch_hip_impl_( + New_grid_launch_tag, + dim3 num_blocks, + dim3 dim_blocks, + int group_mem_bytes, + hipStream_t stream, + const char* kernel_name, + K k) + { + void* lck_stream = nullptr; + auto acc_v = lock_stream_hip_(stream, lck_stream); + auto stream_guard = make_RAII_guard( + std::bind( + print_prelaunch_trace_, + kernel_name, + num_blocks, + dim_blocks, + group_mem_bytes, + stream), + std::bind( + unlock_stream_hip_, stream, lck_stream, kernel_name, &acc_v)); + + try { + grid_launch_hip_impl_( + New_grid_launch_tag{}, + std::move(num_blocks), + std::move(dim_blocks), + group_mem_bytes, + acc_v, + std::move(k)); + } + catch (std::exception& ex) { + std::cerr << "Failed in " << __func__ << ", with exception: " + << ex.what() << std::endl; + throw; + } + } + + template + requires(Domain == {hipLaunchParm, Ts...}) + inline + void grid_launch_hip_impl_( + Old_grid_launch_tag, + dim3 num_blocks, + dim3 dim_blocks, + int group_mem_bytes, + hipStream_t stream, + K k) + { + grid_launch_hip_impl_( + New_grid_launch_tag{}, + std::move(num_blocks), + std::move(dim_blocks), + group_mem_bytes, + std::move(stream), + std::move(k)); + } + + template + requires(Domain == {hipLaunchParm, Ts...}) + inline + void grid_launch_hip_impl_( + Old_grid_launch_tag, + dim3 num_blocks, + dim3 dim_blocks, + int group_mem_bytes, + hipStream_t stream, + const char* kernel_name, + K k) + { + grid_launch_hip_impl_( + New_grid_launch_tag{}, + std::move(num_blocks), + std::move(dim_blocks), + group_mem_bytes, + std::move(stream), + kernel_name, + std::move(k)); + } + + template + requires(Domain == {Ts...}) + inline + std::enable_if_t::value> grid_launch_hip_( + dim3 num_blocks, + dim3 dim_blocks, + int group_mem_bytes, + hipStream_t stream, + const char* kernel_name, + K k) + { + grid_launch_hip_impl_( + is_new_grid_launch_t{}, + std::move(num_blocks), + std::move(dim_blocks), + group_mem_bytes, + std::move(stream), + kernel_name, + std::move(k)); + } + + template + requires(Domain == {Ts...}) + inline + std::enable_if_t::value> grid_launch_hip_( + dim3 num_blocks, + dim3 dim_blocks, + int group_mem_bytes, + hipStream_t stream, + K k) + { + grid_launch_hip_impl_( + is_new_grid_launch_t{}, + std::move(num_blocks), + std::move(dim_blocks), + group_mem_bytes, + std::move(stream), + std::move(k)); + } + + // TODO: these are temporary and purposefully noisy and disruptive. + #define make_kernel_name_hip(k, n)\ + HIP_kernel_functor_name_begin ## _ ## k ## _ ## \ + HIP_kernel_functor_name_end ## _ ## n + + #define make_kernel_functor_hip_30(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23,\ + p24, p25, p26, p27)\ + struct make_kernel_name_hip(function_name, 28) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + std::decay_t _p16_;\ + std::decay_t _p17_;\ + std::decay_t _p18_;\ + std::decay_t _p19_;\ + std::decay_t _p20_;\ + std::decay_t _p21_;\ + std::decay_t _p22_;\ + std::decay_t _p23_;\ + std::decay_t _p24_;\ + std::decay_t _p25_;\ + std::decay_t _p26_;\ + std::decay_t _p27_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ + _p18_, _p19_, _p20_, _p21_, _p22_, _p23_, _p24_, _p25_,\ + _p26_, _p27_);\ + }\ + } + #define make_kernel_functor_hip_29(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23,\ + p24, p25, p26)\ + struct make_kernel_name_hip(function_name, 27) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + std::decay_t _p16_;\ + std::decay_t _p17_;\ + std::decay_t _p18_;\ + std::decay_t _p19_;\ + std::decay_t _p20_;\ + std::decay_t _p21_;\ + std::decay_t _p22_;\ + std::decay_t _p23_;\ + std::decay_t _p24_;\ + std::decay_t _p25_;\ + std::decay_t _p26_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ + _p18_, _p19_, _p20_, _p21_, _p22_, _p23_, _p24_, _p25_,\ + _p26_);\ + }\ + } + #define make_kernel_functor_hip_28(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23,\ + p24, p25)\ + struct make_kernel_name_hip(function_name, 26) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + std::decay_t _p16_;\ + std::decay_t _p17_;\ + std::decay_t _p18_;\ + std::decay_t _p19_;\ + std::decay_t _p20_;\ + std::decay_t _p21_;\ + std::decay_t _p22_;\ + std::decay_t _p23_;\ + std::decay_t _p24_;\ + std::decay_t _p25_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ + _p18_, _p19_, _p20_, _p21_, _p22_, _p23_, _p24_, _p25_);\ + }\ + } + #define make_kernel_functor_hip_27(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23,\ + p24)\ + struct make_kernel_name_hip(function_name, 25) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + std::decay_t _p16_;\ + std::decay_t _p17_;\ + std::decay_t _p18_;\ + std::decay_t _p19_;\ + std::decay_t _p20_;\ + std::decay_t _p21_;\ + std::decay_t _p22_;\ + std::decay_t _p23_;\ + std::decay_t _p24_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ + _p18_, _p19_, _p20_, _p21_, _p22_, _p23_, _p24_);\ + }\ + } + #define make_kernel_functor_hip_26(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23)\ + struct make_kernel_name_hip(function_name, 24) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + std::decay_t _p16_;\ + std::decay_t _p17_;\ + std::decay_t _p18_;\ + std::decay_t _p19_;\ + std::decay_t _p20_;\ + std::decay_t _p21_;\ + std::decay_t _p22_;\ + std::decay_t _p23_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ + _p18_, _p19_, _p20_, _p21_, _p22_, _p23_);\ + }\ + } + #define make_kernel_functor_hip_25(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22)\ + struct make_kernel_name_hip(function_name, 23) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + std::decay_t _p16_;\ + std::decay_t _p17_;\ + std::decay_t _p18_;\ + std::decay_t _p19_;\ + std::decay_t _p20_;\ + std::decay_t _p21_;\ + std::decay_t _p22_;\ + __attribute__((used, flatten))\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ + _p18_, _p19_, _p20_, _p21_, _p22_);\ + }\ + } + #define make_kernel_functor_hip_24(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21)\ + struct make_kernel_name_hip(function_name, 22) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + std::decay_t _p16_;\ + std::decay_t _p17_;\ + std::decay_t _p18_;\ + std::decay_t _p19_;\ + std::decay_t _p20_;\ + std::decay_t _p21_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ + _p18_, _p19_, _p20_, _p21_);\ + }\ + } + #define make_kernel_functor_hip_23(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20)\ + struct make_kernel_name_hip(function_name, 21) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + std::decay_t _p16_;\ + std::decay_t _p17_;\ + std::decay_t _p18_;\ + std::decay_t _p19_;\ + std::decay_t _p20_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ + _p18_, _p19_, _p20_);\ + }\ + } + #define make_kernel_functor_hip_22(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15, p16, p17, p18, p19)\ + struct make_kernel_name_hip(function_name, 20) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + std::decay_t _p16_;\ + std::decay_t _p17_;\ + std::decay_t _p18_;\ + std::decay_t _p19_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ + _p18_, _p19_);\ + }\ + } + #define make_kernel_functor_hip_21(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15, p16, p17, p18)\ + struct make_kernel_name_hip(function_name, 19) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + std::decay_t _p16_;\ + std::decay_t _p17_;\ + std::decay_t _p18_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_,\ + _p18_);\ + }\ + } + #define make_kernel_functor_hip_20(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15, p16, p17)\ + struct make_kernel_name_hip(function_name, 18) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + std::decay_t _p16_;\ + std::decay_t _p17_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_, _p17_);\ + }\ + } + #define make_kernel_functor_hip_19(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15, p16)\ + struct make_kernel_name_hip(function_name, 17) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + std::decay_t _p16_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_, _p16_);\ + }\ + } + #define make_kernel_functor_hip_18(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14, p15)\ + struct make_kernel_name_hip(function_name, 16) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + std::decay_t _p15_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_, _p15_);\ + }\ + } + #define make_kernel_functor_hip_17(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13, p14)\ + struct make_kernel_name_hip(function_name, 15) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + std::decay_t _p14_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_, _p14_);\ + }\ + } + #define make_kernel_functor_hip_16(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12, p13)\ + struct make_kernel_name_hip(function_name, 14) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + std::decay_t _p13_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_, _p13_);\ + }\ + } + #define make_kernel_functor_hip_15(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11, p12)\ + struct make_kernel_name_hip(function_name, 13) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + std::decay_t _p12_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_, _p12_);\ + }\ + } + #define make_kernel_functor_hip_14(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,\ + p10, p11)\ + struct make_kernel_name_hip(function_name, 12) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + std::decay_t _p11_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_, _p11_);\ + }\ + } + #define make_kernel_functor_hip_13(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)\ + struct make_kernel_name_hip(function_name, 11) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + std::decay_t _p10_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_, _p9_,\ + _p10_);\ + }\ + } + #define make_kernel_functor_hip_12(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\ + struct make_kernel_name_hip(function_name, 10) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + std::decay_t _p9_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_,\ + _p9_);\ + }\ + } + #define make_kernel_functor_hip_11(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\ + struct make_kernel_name_hip(function_name, 9) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + std::decay_t _p8_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(\ + _p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_, _p8_);\ + }\ + } + #define make_kernel_functor_hip_10(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6, p7)\ + struct make_kernel_name_hip(function_name, 8) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + std::decay_t _p7_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(_p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_, _p7_);\ + }\ + } + #define make_kernel_functor_hip_9(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5, p6)\ + struct make_kernel_name_hip(function_name, 7) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + std::decay_t _p6_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(_p0_, _p1_, _p2_, _p3_, _p4_, _p5_, _p6_);\ + }\ + } + #define make_kernel_functor_hip_8(\ + function_name, kernel_name, p0, p1, p2, p3, p4, p5)\ + struct make_kernel_name_hip(function_name, 6) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + std::decay_t _p5_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(_p0_, _p1_, _p2_, _p3_, _p4_, _p5_);\ + }\ + } + #define make_kernel_functor_hip_7(\ + function_name, kernel_name, p0, p1, p2, p3, p4)\ + struct make_kernel_name_hip(function_name, 5) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + std::decay_t _p4_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(_p0_, _p1_, _p2_, _p3_, _p4_);\ + }\ + } + #define make_kernel_functor_hip_6(function_name, kernel_name, p0, p1, p2, p3)\ + struct make_kernel_name_hip(function_name, 4) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + std::decay_t _p3_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(_p0_, _p1_, _p2_, _p3_);\ + }\ + } + #define make_kernel_functor_hip_5(function_name, kernel_name, p0, p1, p2)\ + struct make_kernel_name_hip(function_name, 3) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + std::decay_t _p2_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(_p0_, _p1_, _p2_);\ + }\ + } + #define make_kernel_functor_hip_4(function_name, kernel_name, p0, p1)\ + struct make_kernel_name_hip(function_name, 2) {\ + std::decay_t _p0_;\ + std::decay_t _p1_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(_p0_, _p1_);\ + }\ + } + #define fofo(f, n) kernel_prefix_hip ## f ## kernel_suffix_hip ## n + #define make_kernel_functor_hip_3(function_name, kernel_name, p0)\ + struct make_kernel_name_hip(function_name, 1) {\ + std::decay_t _p0_;\ + void operator()(const hc::tiled_index<3>&) const [[hc]]\ + {\ + kernel_name(_p0_);\ + }\ + } + #define make_kernel_functor_hip_2(function_name, kernel_name)\ + struct make_kernel_name_hip(function_name, 0) {\ + void operator()(const hc::tiled_index<3>&) [[hc]]\ + {\ + return kernel_name(hipLaunchParm{});\ + }\ + } + #define make_kernel_functor_hip_1(...) + #define make_kernel_functor_hip_0(...) + #define make_kernel_functor_hip_(...)\ + overload_macro_hip_(make_kernel_functor_hip_, __VA_ARGS__) + + + #define hipLaunchNamedKernelGGL(\ + function_name,\ + kernel_name,\ + num_blocks,\ + dim_blocks,\ + group_mem_bytes,\ + stream,\ + ...)\ + do {\ + make_kernel_functor_hip_(function_name, kernel_name, __VA_ARGS__)\ + hip_kernel_functor_impl_{__VA_ARGS__};\ + hip_impl::grid_launch_hip_(\ + num_blocks,\ + dim_blocks,\ + group_mem_bytes,\ + stream,\ + #kernel_name,\ + hip_kernel_functor_impl_);\ + } while(0) + + #define hipLaunchKernelGGL(\ + kernel_name, num_blocks, dim_blocks, group_mem_bytes, stream, ...)\ + do {\ + hipLaunchNamedKernelGGL(\ + unnamed,\ + kernel_name,\ + num_blocks,\ + dim_blocks,\ + group_mem_bytes,\ + stream,\ + ##__VA_ARGS__);\ + } while (0) + + #define hipLaunchKernel(\ + kernel_name, num_blocks, dim_blocks, group_mem_bytes, stream, ...)\ + do {\ + hipLaunchKernelGGL(\ + kernel_name,\ + num_blocks,\ + dim_blocks,\ + group_mem_bytes,\ + stream,\ + hipLaunchParm{},\ + ##__VA_ARGS__);\ + } while(0) +} \ No newline at end of file diff --git a/projects/hip/include/hip/hcc_detail/program_state.hpp b/projects/hip/include/hip/hcc_detail/program_state.hpp new file mode 100644 index 0000000000..02e2f1e524 --- /dev/null +++ b/projects/hip/include/hip/hcc_detail/program_state.hpp @@ -0,0 +1,86 @@ +/* +Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. + +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. +*/ + +#pragma once + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +struct ihipModuleSymbol_t; +using hipFunction_t = ihipModuleSymbol_t*; + +namespace std +{ + template<> + struct hash { + size_t operator()(hsa_agent_t x) const + { + return hash{}(x.handle); + } + }; +} + +inline +constexpr +bool operator==(hsa_agent_t x, hsa_agent_t y) +{ + return x.handle == y.handle; +} + +namespace hip_impl +{ + struct Kernel_descriptor { + std::uint64_t kernel_object_; + std::uint32_t group_size_; + std::uint32_t private_size_; + std::string name_; + + operator hipFunction_t() const + { // TODO: this is awful and only meant for illustration. + return reinterpret_cast( + const_cast(this)); + } + }; + + using RAII_global = std::unique_ptr; + + const std::unordered_map< + hsa_agent_t, std::vector>& executables(); + const std::unordered_map< + std::uintptr_t, + std::vector>>& functions(); + const std::unordered_map& function_names(); + std::unordered_map& globals(); + + hsa_executable_t load_executable( + const std::string& file, + hsa_executable_t executable, + hsa_agent_t agent); +} // Namespace hip_impl. \ No newline at end of file diff --git a/projects/hip/include/hip/hcc_detail/texture_functions.h b/projects/hip/include/hip/hcc_detail/texture_functions.h index d08b429fca..3675c0639d 100644 --- a/projects/hip/include/hip/hcc_detail/texture_functions.h +++ b/projects/hip/include/hip/hcc_detail/texture_functions.h @@ -39,7 +39,10 @@ union TData { unsigned int ADDRESS_SPACE_2 *i = (unsigned int ADDRESS_SPACE_2*)textureObject; \ unsigned int ADDRESS_SPACE_2 *s = i + HIP_SAMPLER_OBJECT_OFFSET_DWORD; \ TData texel; - +#define TEXTURE_REF_PARAMETERS_INIT \ + unsigned int ADDRESS_SPACE_2 *i = (unsigned int ADDRESS_SPACE_2*)texRef.textureObject; \ + unsigned int ADDRESS_SPACE_2 *s = i + HIP_SAMPLER_OBJECT_OFFSET_DWORD; \ + TData texel; #define TEXTURE_SET_FLOAT \ *retVal = texel.f.x; @@ -2970,6 +2973,232 @@ __TEXTURE_FUNCTIONS_DECL__ T tex2DLayeredLod(hipTextureObject_t textureObject, f //////////////////////////////////////////////////////////// // Texture Reference APIs //////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1Dfetch(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + template __TEXTURE_FUNCTIONS_DECL__ char tex1Dfetch(texture texRef, hipTextureObject_t textureObject, int x) { @@ -3194,6 +3423,223 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex1Dfetch(texture texR TEXTURE_RETURN_FLOAT_XYZW; } +//////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1D(texture texRef, int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT_XYZW; +} + //////////////////////////////////////////////////////////// template __TEXTURE_FUNCTIONS_DECL__ char tex1D(texture texRef, hipTextureObject_t textureObject, int x) @@ -3395,6 +3841,14 @@ __TEXTURE_FUNCTIONS_DECL__ float tex1D(texture texRef, hip TEXTURE_RETURN_FLOAT; } +template +__TEXTURE_FUNCTIONS_DECL__ float tex1D(texture texRef, /*hipTextureObject_t textureObject,*/ int x) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1D(i, s, x); + TEXTURE_RETURN_FLOAT; +} + template __TEXTURE_FUNCTIONS_DECL__ float1 tex1D(texture texRef, hipTextureObject_t textureObject, int x) { @@ -3421,6 +3875,231 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex1D(texture texRef, h //////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_CHAR_X; +} +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1DLod(texture texRef, float x, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1D(i, s, x, level); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + template __TEXTURE_FUNCTIONS_DECL__ char tex1DLod(texture texRef, hipTextureObject_t textureObject, float x, float level) { @@ -3646,6 +4325,232 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex1DLod(texture texRef //////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1DGrad(texture texRef, float x, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1D(i, s, x, dx, dy); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + template __TEXTURE_FUNCTIONS_DECL__ char tex1DGrad(texture texRef, hipTextureObject_t textureObject, float x, float dx, float dy) { @@ -3870,6 +4775,202 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex1DGrad(texture texRe TEXTURE_RETURN_FLOAT_XYZW; } +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + + + //////////////////////////////////////////////////////////// template @@ -4072,6 +5173,22 @@ __TEXTURE_FUNCTIONS_DECL__ float tex2D(texture texRef, hip TEXTURE_RETURN_FLOAT; } +template +__TEXTURE_FUNCTIONS_DECL__ float tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ float1 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) { @@ -4080,6 +5197,14 @@ __TEXTURE_FUNCTIONS_DECL__ float1 tex2D(texture texRef, h TEXTURE_RETURN_FLOAT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ float2 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) { @@ -4088,6 +5213,14 @@ __TEXTURE_FUNCTIONS_DECL__ float2 tex2D(texture texRef, h TEXTURE_RETURN_FLOAT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex2D(texture texRef, float x, float y) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2D(i, s, hc::short_vector::float2(x, y).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ float4 tex2D(texture texRef, hipTextureObject_t textureObject, float x, float y) { @@ -4098,6 +5231,232 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex2D(texture texRef, h //////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex2DLod(texture texRef, float x, float y, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2D(i, s, hc::short_vector::float2(x, y).get_vector(), level); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + template __TEXTURE_FUNCTIONS_DECL__ char tex2DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float level) { @@ -4324,6 +5683,316 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex2DLod(texture texRef //////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex2DGrad(texture texRef, float x, float y, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2D(i, s, + hc::short_vector::float2(x, y).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + template __TEXTURE_FUNCTIONS_DECL__ char tex2DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float2 dx, float2 dy) { @@ -4634,6 +6303,232 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex2DGrad(texture texRe //////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex3D(texture texRef, float x, float y, float z) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + template __TEXTURE_FUNCTIONS_DECL__ char tex3D(texture texRef, hipTextureObject_t textureObject, float x, float y, float z) { @@ -4860,6 +6755,168 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex3D(texture texRef, h //////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex3DLod(texture texRef, float x, float y, float z, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_3D(i, s, hc::short_vector::float4(x, y, z, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + template __TEXTURE_FUNCTIONS_DECL__ char tex3DLod(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float level) { @@ -5020,6 +7077,316 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex3DLod(texture texRef TEXTURE_RETURN_FLOAT_XYZW; } +//////////////////////////////////////////////////////////// + +template +__TEXTURE_FUNCTIONS_DECL__ char tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex3DGrad(texture texRef, float x, float y, float z, float4 dx, float4 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f =__ockl_image_sample_grad_3D(i, s, + hc::short_vector::float4(x, y, z, 0.0f).get_vector(), + hc::short_vector::float4(dx.x, dx.y, dx.z, dx.w).get_vector(), + hc::short_vector::float4(dy.x, dy.y, dy.z, dy.w).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + //////////////////////////////////////////////////////////// template __TEXTURE_FUNCTIONS_DECL__ char tex3DGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, float z, float4 dx, float4 dy) @@ -5331,6 +7698,232 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex3DGrad(texture texRe //////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1DLayered(texture texRef, float x, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_1Da(i, s, hc::short_vector::float2(x, layer).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + template __TEXTURE_FUNCTIONS_DECL__ char tex1DLayered(texture texRef, hipTextureObject_t textureObject, float x, int layer) { @@ -5557,6 +8150,232 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex1DLayered(texture te //////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_CHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_CHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_CHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_CHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UCHAR; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UCHAR_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UCHAR_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UCHAR_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_SHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_SHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_SHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_SHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_USHORT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_USHORT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_USHORT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_USHORT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_INT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_INT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_INT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_INT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UINT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UINT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UINT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_UINT_XYZW; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_FLOAT; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_FLOAT_X; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_FLOAT_XY; +} + +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex1DLayeredLod(texture texRef, float x, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), level); + TEXTURE_RETURN_FLOAT_XYZW; +} + +//////////////////////////////////////////////////////////// + template __TEXTURE_FUNCTIONS_DECL__ char tex1DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, int layer, float level) { @@ -5783,6 +8602,14 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex1DLayeredLod(texture //////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_CHAR; +} + template __TEXTURE_FUNCTIONS_DECL__ char tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5791,6 +8618,14 @@ __TEXTURE_FUNCTIONS_DECL__ char tex1DLayeredGrad(texture te TEXTURE_RETURN_CHAR; } +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_CHAR_X; +} + template __TEXTURE_FUNCTIONS_DECL__ char1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5799,6 +8634,14 @@ __TEXTURE_FUNCTIONS_DECL__ char1 tex1DLayeredGrad(texture TEXTURE_RETURN_CHAR_X; } +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_CHAR_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ char2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5807,6 +8650,14 @@ __TEXTURE_FUNCTIONS_DECL__ char2 tex1DLayeredGrad(texture TEXTURE_RETURN_CHAR_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_CHAR_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ char4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5815,6 +8666,14 @@ __TEXTURE_FUNCTIONS_DECL__ char4 tex1DLayeredGrad(texture TEXTURE_RETURN_CHAR_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UCHAR; +} + template __TEXTURE_FUNCTIONS_DECL__ unsigned char tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5823,6 +8682,14 @@ __TEXTURE_FUNCTIONS_DECL__ unsigned char tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UCHAR_X; +} + template __TEXTURE_FUNCTIONS_DECL__ uchar1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5831,6 +8698,14 @@ __TEXTURE_FUNCTIONS_DECL__ uchar1 tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UCHAR_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ uchar2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5839,6 +8714,14 @@ __TEXTURE_FUNCTIONS_DECL__ uchar2 tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UCHAR_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ uchar4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5847,6 +8730,14 @@ __TEXTURE_FUNCTIONS_DECL__ uchar4 tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ short tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_SHORT; +} + template __TEXTURE_FUNCTIONS_DECL__ short tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5855,6 +8746,14 @@ __TEXTURE_FUNCTIONS_DECL__ short tex1DLayeredGrad(texture TEXTURE_RETURN_SHORT; } +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_SHORT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ short1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5863,6 +8762,14 @@ __TEXTURE_FUNCTIONS_DECL__ short1 tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ short2 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_SHORT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ short2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5871,6 +8778,14 @@ __TEXTURE_FUNCTIONS_DECL__ short2 tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ short4 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_SHORT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ short4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5879,6 +8794,14 @@ __TEXTURE_FUNCTIONS_DECL__ short4 tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_USHORT; +} + template __TEXTURE_FUNCTIONS_DECL__ unsigned short tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5887,6 +8810,14 @@ __TEXTURE_FUNCTIONS_DECL__ unsigned short tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_USHORT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ ushort1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5895,6 +8826,14 @@ __TEXTURE_FUNCTIONS_DECL__ ushort1 tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_USHORT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ ushort2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5903,6 +8842,14 @@ __TEXTURE_FUNCTIONS_DECL__ ushort2 tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_USHORT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ ushort4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5911,6 +8858,14 @@ __TEXTURE_FUNCTIONS_DECL__ ushort4 tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ int tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_INT; +} + template __TEXTURE_FUNCTIONS_DECL__ int tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5919,6 +8874,14 @@ __TEXTURE_FUNCTIONS_DECL__ int tex1DLayeredGrad(texture texR TEXTURE_RETURN_INT; } +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_INT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ int1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5927,6 +8890,14 @@ __TEXTURE_FUNCTIONS_DECL__ int1 tex1DLayeredGrad(texture te TEXTURE_RETURN_INT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_INT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ int2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5935,6 +8906,14 @@ __TEXTURE_FUNCTIONS_DECL__ int2 tex1DLayeredGrad(texture te TEXTURE_RETURN_INT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_INT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ int4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5943,6 +8922,14 @@ __TEXTURE_FUNCTIONS_DECL__ int4 tex1DLayeredGrad(texture te TEXTURE_RETURN_INT_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UINT; +} + template __TEXTURE_FUNCTIONS_DECL__ unsigned int tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5951,6 +8938,14 @@ __TEXTURE_FUNCTIONS_DECL__ unsigned int tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ uint1 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UINT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ uint1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5959,6 +8954,14 @@ __TEXTURE_FUNCTIONS_DECL__ uint1 tex1DLayeredGrad(texture TEXTURE_RETURN_UINT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UINT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ uint2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5967,6 +8970,14 @@ __TEXTURE_FUNCTIONS_DECL__ uint2 tex1DLayeredGrad(texture TEXTURE_RETURN_UINT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_UINT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ uint4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5975,6 +8986,14 @@ __TEXTURE_FUNCTIONS_DECL__ uint4 tex1DLayeredGrad(texture TEXTURE_RETURN_UINT_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ float tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_FLOAT; +} + template __TEXTURE_FUNCTIONS_DECL__ float tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5983,6 +9002,14 @@ __TEXTURE_FUNCTIONS_DECL__ float tex1DLayeredGrad(texture TEXTURE_RETURN_FLOAT; } +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_FLOAT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ float1 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5991,6 +9018,14 @@ __TEXTURE_FUNCTIONS_DECL__ float1 tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ float2 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_FLOAT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ float2 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -5999,6 +9034,14 @@ __TEXTURE_FUNCTIONS_DECL__ float2 tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ float4 tex1DLayeredGrad(texture texRef, float x, int layer, float dx, float dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_1Da(i, s, hc::short_vector::float2(x, layer).get_vector(), dx, dy); + TEXTURE_RETURN_FLOAT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ float4 tex1DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, int layer, float dx, float dy) { @@ -6009,6 +9052,14 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex1DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ char tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR; +} + template __TEXTURE_FUNCTIONS_DECL__ char tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6017,6 +9068,14 @@ __TEXTURE_FUNCTIONS_DECL__ char tex2DLayered(texture texRef TEXTURE_RETURN_CHAR; } +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + template __TEXTURE_FUNCTIONS_DECL__ char1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6025,6 +9084,14 @@ __TEXTURE_FUNCTIONS_DECL__ char1 tex2DLayered(texture texR TEXTURE_RETURN_CHAR_X; } +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ char2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6033,6 +9100,14 @@ __TEXTURE_FUNCTIONS_DECL__ char2 tex2DLayered(texture texR TEXTURE_RETURN_CHAR_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ char4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6041,6 +9116,14 @@ __TEXTURE_FUNCTIONS_DECL__ char4 tex2DLayered(texture texR TEXTURE_RETURN_CHAR_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR; +} + template __TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6049,6 +9132,14 @@ __TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLayered(texture +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + template __TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6057,6 +9148,14 @@ __TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLayered(texture te TEXTURE_RETURN_UCHAR_X; } +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6065,6 +9164,14 @@ __TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLayered(texture te TEXTURE_RETURN_UCHAR_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6073,6 +9180,14 @@ __TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLayered(texture te TEXTURE_RETURN_UCHAR_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ short tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT; +} + template __TEXTURE_FUNCTIONS_DECL__ short tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6081,6 +9196,14 @@ __TEXTURE_FUNCTIONS_DECL__ short tex2DLayered(texture texR TEXTURE_RETURN_SHORT; } +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ short1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6089,6 +9212,14 @@ __TEXTURE_FUNCTIONS_DECL__ short1 tex2DLayered(texture te TEXTURE_RETURN_SHORT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ short2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6097,6 +9228,14 @@ __TEXTURE_FUNCTIONS_DECL__ short2 tex2DLayered(texture te TEXTURE_RETURN_SHORT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ short4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6105,6 +9244,14 @@ __TEXTURE_FUNCTIONS_DECL__ short4 tex2DLayered(texture te TEXTURE_RETURN_SHORT_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT; +} + template __TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6113,6 +9260,14 @@ __TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLayered(texture +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6121,6 +9276,14 @@ __TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLayered(texture TEXTURE_RETURN_USHORT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6129,6 +9292,14 @@ __TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLayered(texture TEXTURE_RETURN_USHORT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6137,6 +9308,14 @@ __TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLayered(texture TEXTURE_RETURN_USHORT_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ int tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_INT; +} + template __TEXTURE_FUNCTIONS_DECL__ int tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6145,6 +9324,14 @@ __TEXTURE_FUNCTIONS_DECL__ int tex2DLayered(texture texRef, TEXTURE_RETURN_INT; } +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_INT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ int1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6153,6 +9340,14 @@ __TEXTURE_FUNCTIONS_DECL__ int1 tex2DLayered(texture texRef TEXTURE_RETURN_INT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_INT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ int2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6161,6 +9356,14 @@ __TEXTURE_FUNCTIONS_DECL__ int2 tex2DLayered(texture texRef TEXTURE_RETURN_INT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ int4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6169,6 +9372,14 @@ __TEXTURE_FUNCTIONS_DECL__ int4 tex2DLayered(texture texRef TEXTURE_RETURN_INT_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UINT; +} + template __TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6177,6 +9388,14 @@ __TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLayered(texture +__TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UINT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6185,6 +9404,14 @@ __TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLayered(texture texR TEXTURE_RETURN_UINT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6193,6 +9420,14 @@ __TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLayered(texture texR TEXTURE_RETURN_UINT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6201,6 +9436,14 @@ __TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLayered(texture texR TEXTURE_RETURN_UINT_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ float tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT; +} + template __TEXTURE_FUNCTIONS_DECL__ float tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6209,6 +9452,14 @@ __TEXTURE_FUNCTIONS_DECL__ float tex2DLayered(texture texR TEXTURE_RETURN_FLOAT; } +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ float1 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6217,6 +9468,14 @@ __TEXTURE_FUNCTIONS_DECL__ float1 tex2DLayered(texture te TEXTURE_RETURN_FLOAT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ float2 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6225,6 +9484,14 @@ __TEXTURE_FUNCTIONS_DECL__ float2 tex2DLayered(texture te TEXTURE_RETURN_FLOAT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex2DLayered(texture texRef, float x, float y, int layer) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ float4 tex2DLayered(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer) { @@ -6235,6 +9502,14 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex2DLayered(texture te //////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR; +} + template __TEXTURE_FUNCTIONS_DECL__ char tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6243,6 +9518,14 @@ __TEXTURE_FUNCTIONS_DECL__ char tex2DLayeredLod(texture tex TEXTURE_RETURN_CHAR; } +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR_X; +} + template __TEXTURE_FUNCTIONS_DECL__ char1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6251,6 +9534,14 @@ __TEXTURE_FUNCTIONS_DECL__ char1 tex2DLayeredLod(texture t TEXTURE_RETURN_CHAR_X; } +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ char2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6259,6 +9550,14 @@ __TEXTURE_FUNCTIONS_DECL__ char2 tex2DLayeredLod(texture t TEXTURE_RETURN_CHAR_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_CHAR_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ char4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6267,6 +9566,14 @@ __TEXTURE_FUNCTIONS_DECL__ char4 tex2DLayeredLod(texture t TEXTURE_RETURN_CHAR_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR; +} + template __TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6275,6 +9582,14 @@ __TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLayeredLod(texture +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR_X; +} + template __TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6283,6 +9598,14 @@ __TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLayeredLod(texture TEXTURE_RETURN_UCHAR_X; } +template +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6291,6 +9614,14 @@ __TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLayeredLod(texture TEXTURE_RETURN_UCHAR_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UCHAR_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6299,6 +9630,14 @@ __TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLayeredLod(texture TEXTURE_RETURN_UCHAR_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ short tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_SHORT; +} + template __TEXTURE_FUNCTIONS_DECL__ short tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6307,6 +9646,14 @@ __TEXTURE_FUNCTIONS_DECL__ short tex2DLayeredLod(texture t TEXTURE_RETURN_SHORT; } +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_SHORT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ short1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6315,6 +9662,14 @@ __TEXTURE_FUNCTIONS_DECL__ short1 tex2DLayeredLod(texture TEXTURE_RETURN_SHORT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ short2 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_SHORT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ short2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6323,6 +9678,14 @@ __TEXTURE_FUNCTIONS_DECL__ short2 tex2DLayeredLod(texture TEXTURE_RETURN_SHORT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ short4 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_SHORT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ short4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6331,6 +9694,14 @@ __TEXTURE_FUNCTIONS_DECL__ short4 tex2DLayeredLod(texture TEXTURE_RETURN_SHORT_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_USHORT; +} + template __TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6339,6 +9710,14 @@ __TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLayeredLod(texture +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_USHORT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6347,6 +9726,14 @@ __TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLayeredLod(texture +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_USHORT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6355,6 +9742,14 @@ __TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLayeredLod(texture +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_USHORT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6363,6 +9758,14 @@ __TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLayeredLod(texture +__TEXTURE_FUNCTIONS_DECL__ int tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT; +} + template __TEXTURE_FUNCTIONS_DECL__ int tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6371,6 +9774,14 @@ __TEXTURE_FUNCTIONS_DECL__ int tex2DLayeredLod(texture texRe TEXTURE_RETURN_INT; } +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ int1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6379,6 +9790,14 @@ __TEXTURE_FUNCTIONS_DECL__ int1 tex2DLayeredLod(texture tex TEXTURE_RETURN_INT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ int2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6387,6 +9806,14 @@ __TEXTURE_FUNCTIONS_DECL__ int2 tex2DLayeredLod(texture tex TEXTURE_RETURN_INT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_INT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ int4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6395,6 +9822,14 @@ __TEXTURE_FUNCTIONS_DECL__ int4 tex2DLayeredLod(texture tex TEXTURE_RETURN_INT_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT; +} + template __TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6403,6 +9838,14 @@ __TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLayeredLod(texture +__TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6411,6 +9854,14 @@ __TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLayeredLod(texture t TEXTURE_RETURN_UINT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6419,6 +9870,14 @@ __TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLayeredLod(texture t TEXTURE_RETURN_UINT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_UINT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6427,6 +9886,14 @@ __TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLayeredLod(texture t TEXTURE_RETURN_UINT_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ float tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT; +} + template __TEXTURE_FUNCTIONS_DECL__ float tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6435,6 +9902,14 @@ __TEXTURE_FUNCTIONS_DECL__ float tex2DLayeredLod(texture t TEXTURE_RETURN_FLOAT; } +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ float1 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6443,6 +9918,14 @@ __TEXTURE_FUNCTIONS_DECL__ float1 tex2DLayeredLod(texture TEXTURE_RETURN_FLOAT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ float2 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ float2 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6451,6 +9934,14 @@ __TEXTURE_FUNCTIONS_DECL__ float2 tex2DLayeredLod(texture TEXTURE_RETURN_FLOAT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ float4 tex2DLayeredLod(texture texRef, float x, float y, int layer, float level) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_lod_2Da(i, s, hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), level); + TEXTURE_RETURN_FLOAT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ float4 tex2DLayeredLod(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float level) { @@ -6461,6 +9952,17 @@ __TEXTURE_FUNCTIONS_DECL__ float4 tex2DLayeredLod(texture //////////////////////////////////////////////////////////// +template +__TEXTURE_FUNCTIONS_DECL__ char tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR; +} + template __TEXTURE_FUNCTIONS_DECL__ char tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6472,6 +9974,17 @@ __TEXTURE_FUNCTIONS_DECL__ char tex2DLayeredGrad(texture te TEXTURE_RETURN_CHAR; } +template +__TEXTURE_FUNCTIONS_DECL__ char1 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR_X; +} + template __TEXTURE_FUNCTIONS_DECL__ char1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6483,6 +9996,17 @@ __TEXTURE_FUNCTIONS_DECL__ char1 tex2DLayeredGrad(texture TEXTURE_RETURN_CHAR_X; } +template +__TEXTURE_FUNCTIONS_DECL__ char2 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ char2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6494,6 +10018,17 @@ __TEXTURE_FUNCTIONS_DECL__ char2 tex2DLayeredGrad(texture TEXTURE_RETURN_CHAR_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ char4 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_CHAR_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ char4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6505,6 +10040,17 @@ __TEXTURE_FUNCTIONS_DECL__ char4 tex2DLayeredGrad(texture TEXTURE_RETURN_CHAR_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR; +} + template __TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6516,6 +10062,17 @@ __TEXTURE_FUNCTIONS_DECL__ unsigned char tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR_X; +} + template __TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6527,6 +10084,17 @@ __TEXTURE_FUNCTIONS_DECL__ uchar1 tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6538,6 +10106,17 @@ __TEXTURE_FUNCTIONS_DECL__ uchar2 tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UCHAR_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6549,6 +10128,17 @@ __TEXTURE_FUNCTIONS_DECL__ uchar4 tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ short tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT; +} + template __TEXTURE_FUNCTIONS_DECL__ short tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6560,6 +10150,17 @@ __TEXTURE_FUNCTIONS_DECL__ short tex2DLayeredGrad(texture TEXTURE_RETURN_SHORT; } +template +__TEXTURE_FUNCTIONS_DECL__ short1 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ short1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6571,6 +10172,17 @@ __TEXTURE_FUNCTIONS_DECL__ short1 tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ short2 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ short2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6582,6 +10194,17 @@ __TEXTURE_FUNCTIONS_DECL__ short2 tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ short4 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_SHORT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ short4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6593,6 +10216,17 @@ __TEXTURE_FUNCTIONS_DECL__ short4 tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT; +} + template __TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6604,6 +10238,17 @@ __TEXTURE_FUNCTIONS_DECL__ unsigned short tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6615,6 +10260,17 @@ __TEXTURE_FUNCTIONS_DECL__ ushort1 tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6626,6 +10282,17 @@ __TEXTURE_FUNCTIONS_DECL__ ushort2 tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_USHORT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6637,6 +10304,17 @@ __TEXTURE_FUNCTIONS_DECL__ ushort4 tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ int tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT; +} + template __TEXTURE_FUNCTIONS_DECL__ int tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6648,6 +10326,17 @@ __TEXTURE_FUNCTIONS_DECL__ int tex2DLayeredGrad(texture texR TEXTURE_RETURN_INT; } +template +__TEXTURE_FUNCTIONS_DECL__ int1 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ int1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6659,6 +10348,17 @@ __TEXTURE_FUNCTIONS_DECL__ int1 tex2DLayeredGrad(texture te TEXTURE_RETURN_INT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ int2 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ int2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6670,6 +10370,17 @@ __TEXTURE_FUNCTIONS_DECL__ int2 tex2DLayeredGrad(texture te TEXTURE_RETURN_INT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ int4 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_INT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ int4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6681,6 +10392,17 @@ __TEXTURE_FUNCTIONS_DECL__ int4 tex2DLayeredGrad(texture te TEXTURE_RETURN_INT_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT; +} + template __TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6692,6 +10414,17 @@ __TEXTURE_FUNCTIONS_DECL__ unsigned int tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6703,6 +10436,17 @@ __TEXTURE_FUNCTIONS_DECL__ uint1 tex2DLayeredGrad(texture TEXTURE_RETURN_UINT_X; } +template +__TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6714,6 +10458,17 @@ __TEXTURE_FUNCTIONS_DECL__ uint2 tex2DLayeredGrad(texture TEXTURE_RETURN_UINT_XY; } +template +__TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_UINT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6725,6 +10480,17 @@ __TEXTURE_FUNCTIONS_DECL__ uint4 tex2DLayeredGrad(texture TEXTURE_RETURN_UINT_XYZW; } +template +__TEXTURE_FUNCTIONS_DECL__ float tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT; +} + template __TEXTURE_FUNCTIONS_DECL__ float tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6736,6 +10502,17 @@ __TEXTURE_FUNCTIONS_DECL__ float tex2DLayeredGrad(texture TEXTURE_RETURN_FLOAT; } +template +__TEXTURE_FUNCTIONS_DECL__ float1 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT_X; +} + template __TEXTURE_FUNCTIONS_DECL__ float1 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6747,6 +10524,17 @@ __TEXTURE_FUNCTIONS_DECL__ float1 tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ float2 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT_XY; +} + template __TEXTURE_FUNCTIONS_DECL__ float2 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { @@ -6758,6 +10546,17 @@ __TEXTURE_FUNCTIONS_DECL__ float2 tex2DLayeredGrad(texture +__TEXTURE_FUNCTIONS_DECL__ float4 tex2DLayeredGrad(texture texRef, float x, float y, int layer, float2 dx, float2 dy) +{ + TEXTURE_REF_PARAMETERS_INIT; + texel.f = __ockl_image_sample_grad_2Da(i, s, + hc::short_vector::float4(x, y, layer, 0.0f).get_vector(), + hc::short_vector::float2(dx.x, dx.y).get_vector(), + hc::short_vector::float2(dy.x, dy.y).get_vector()); + TEXTURE_RETURN_FLOAT_XYZW; +} + template __TEXTURE_FUNCTIONS_DECL__ float4 tex2DLayeredGrad(texture texRef, hipTextureObject_t textureObject, float x, float y, int layer, float2 dx, float2 dy) { diff --git a/projects/hip/include/hip/hcc_detail/texture_types.h b/projects/hip/include/hip/hcc_detail/texture_types.h index 731ed12308..0a99abe451 100644 --- a/projects/hip/include/hip/hcc_detail/texture_types.h +++ b/projects/hip/include/hip/hcc_detail/texture_types.h @@ -93,6 +93,8 @@ struct textureReference float maxMipmapLevelClamp; hipTextureObject_t textureObject; + int numChannels; + enum hipArray_Format format; }; /** diff --git a/projects/hip/include/hip/hip_runtime_api.h b/projects/hip/include/hip/hip_runtime_api.h index a2ebcd27a5..f764599164 100644 --- a/projects/hip/include/hip/hip_runtime_api.h +++ b/projects/hip/include/hip/hip_runtime_api.h @@ -116,8 +116,10 @@ typedef struct hipDeviceProp_t { * Memory type (for pointer attributes) */ enum hipMemoryType { - hipMemoryTypeHost, ///< Memory is physically located on host - hipMemoryTypeDevice ///< Memory is physically located on device. (see deviceId for specific device) + hipMemoryTypeHost, ///< Memory is physically located on host + hipMemoryTypeDevice, ///< Memory is physically located on device. (see deviceId for specific device) + hipMemoryTypeArray, ///< Array memory, physically located on device. (see deviceId for specific device) + hipMemoryTypeUnified ///< Not used currently }; diff --git a/projects/hip/samples/0_Intro/square/Makefile b/projects/hip/samples/0_Intro/square/Makefile index aa48cc5864..9bb0dd8205 100644 --- a/projects/hip/samples/0_Intro/square/Makefile +++ b/projects/hip/samples/0_Intro/square/Makefile @@ -1,20 +1,24 @@ HIP_PATH?= $(wildcard /opt/rocm/hip) +ifeq (,$(HIP_PATH)) + HIP_PATH=../../.. +endif +HIP_PLATFORM=$(shell $(HIP_PATH)/bin/hipconfig --platform) HIPCC=$(HIP_PATH)/bin/hipcc -all: square.hip.out - -square.cuda.out : square.cu - nvcc square.cu -o $@ - -#hipify square.cu > square.cpp -# Then review & finish port in square.cpp -# - -square.hip.out: square.hipref.cpp - $(HIPCC) $(CXXFLAGS) square.hipref.cpp -o $@ +ifeq (${HIP_PLATFORM}, nvcc) + SOURCES=square.cu +else + SOURCES=square.cpp +endif +all: square.out +# Step +square.cpp: square.cu + $(HIP_PATH)/bin/hipify-perl square.cu > square.cpp +square.out: $(SOURCES) + $(HIPCC) $(CXXFLAGS) $(SOURCES) -o $@ clean: - rm -f *.o *.out + rm -f *.o *.out square.cpp diff --git a/projects/hip/samples/0_Intro/square/README.md b/projects/hip/samples/0_Intro/square/README.md index 8f9aec73cb..7a9e04fc5f 100644 --- a/projects/hip/samples/0_Intro/square/README.md +++ b/projects/hip/samples/0_Intro/square/README.md @@ -1,16 +1,13 @@ # Square.md Simple test which shows how to use hipify to port CUDA code to HIP. -See related [blog](http://gpuopen.com/hip-to-be-squared-an-introductory-hip-tutorial) that explains the example. +See related [blog](http://gpuopen.com/hip-to-be-squared-an-introductory-hip-tutorial) that explains the example. +Now it is even simpler and requires no manual modification to the hipified source code - just hipify and compile: 1. Add hip/bin path to the PATH : export PATH=$PATH:[MYHIP]/bin -2. Do $ hipify square.cu > square.cpp - -3. Manually edit square.cpp to add hipLaunchParms lp to kernel parms: - vector_square(hipLaunchParm lp, T *C_d, const T *A_d, size_t N) - - (see square.hipref.cpp for the correct output after running hipify and the above manual step) - -4. make +2. $ make + Make runs these steps. This can be performed on either CUDA or AMD platform: + hipify-perl square.cu > square.cpp # convert cuda code to hip code + hipcc square.cpp # compile into executable diff --git a/projects/hip/samples/0_Intro/square/square.cu b/projects/hip/samples/0_Intro/square/square.cu index 82b31db14a..1c23ba71a1 100644 --- a/projects/hip/samples/0_Intro/square/square.cu +++ b/projects/hip/samples/0_Intro/square/square.cu @@ -38,7 +38,7 @@ THE SOFTWARE. */ template __global__ void -vector_square(T *C_d, const T *A_d, size_t N) +vector_square(T *C_d, T *A_d, size_t N) { size_t offset = (blockIdx.x * blockDim.x + threadIdx.x); size_t stride = blockDim.x * gridDim.x ; diff --git a/projects/hip/samples/2_Cookbook/11_texture_driver/Makefile b/projects/hip/samples/2_Cookbook/11_texture_driver/Makefile new file mode 100644 index 0000000000..b68c5c31c7 --- /dev/null +++ b/projects/hip/samples/2_Cookbook/11_texture_driver/Makefile @@ -0,0 +1,17 @@ +HIP_PATH?= $(wildcard /opt/rocm/hip) +ifeq (,$(HIP_PATH)) + HIP_PATH=../../.. +endif +HIPCC=$(HIP_PATH)/bin/hipcc +HIP_PLATFORM=$(shell $(HIP_PATH)/bin/hipconfig --compiler) + +all: tex2dKernel.code texture2dDrv.out + +texture2dDrv.out: texture2dDrv.cpp + $(HIPCC) $(HIPCC_FLAGS) $< -o $@ + +tex2dKernel.code: tex2dKernel.cpp + $(HIPCC) --genco $(GENCO_FLAGS) $^ -o $@ + +clean: + rm -f *.code *.out diff --git a/projects/hip/samples/2_Cookbook/11_texture_driver/tex2dKernel.cpp b/projects/hip/samples/2_Cookbook/11_texture_driver/tex2dKernel.cpp new file mode 100644 index 0000000000..17ed911808 --- /dev/null +++ b/projects/hip/samples/2_Cookbook/11_texture_driver/tex2dKernel.cpp @@ -0,0 +1,33 @@ +/* +Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. + +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. +*/ + +#include "hip/hip_runtime.h" +extern texture tex; + +__global__ void tex2dKernel(hipLaunchParm lp, float* outputData, + int width, + int height) +{ + int x = hipBlockIdx_x*hipBlockDim_x + hipThreadIdx_x; + int y = hipBlockIdx_y*hipBlockDim_y + hipThreadIdx_y; + outputData[y*width + x] = tex2D(tex, x, y); +} diff --git a/projects/hip/samples/2_Cookbook/11_texture_driver/texture2dDrv.cpp b/projects/hip/samples/2_Cookbook/11_texture_driver/texture2dDrv.cpp new file mode 100644 index 0000000000..a19f4376c3 --- /dev/null +++ b/projects/hip/samples/2_Cookbook/11_texture_driver/texture2dDrv.cpp @@ -0,0 +1,156 @@ +/* +Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. + +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. +*/ + +#include "hip/hip_runtime.h" +#include "hip/hip_runtime_api.h" +#include +#include +#include +#include + +#define fileName "tex2dKernel.code" + +texture tex; +bool testResult = false; + +#define HIP_CHECK(cmd) \ +{\ + hipError_t status = cmd;\ + if(status != hipSuccess) {std::cout<<"error: #"<