-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #150 from CongMa13/permute_test
Implement Permutation with CK
- Loading branch information
Showing
48 changed files
with
3,011 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/******************************************************************************* | ||
* | ||
* MIT License | ||
* | ||
* Copyright (C) 2021-2024 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. | ||
* | ||
*******************************************************************************/ | ||
#ifndef HIPTENSOR_CONFIG_HPP | ||
#define HIPTENSOR_CONFIG_HPP | ||
|
||
namespace hiptensor | ||
{ | ||
|
||
/// | ||
/// Architecture support | ||
/// Guaranteed symbols: | ||
/// HIPTENSOR_ARCH_GFX908 | ||
/// HIPTENSOR_ARCH_GFX90a | ||
/// HIPTENSOR_ARCH_GFX940 | ||
/// HIPTENSOR_ARCH_GFX941 | ||
/// HIPTENSOR_ARCH_GFX942 | ||
#if defined(__gfx908__) | ||
#define HIPTENSOR_ARCH_GFX908 __gfx908__ | ||
#elif defined(__gfx90a__) | ||
#define HIPTENSOR_ARCH_GFX90A __gfx90a__ | ||
#elif defined(__gfx940__) | ||
#define HIPTENSOR_ARCH_GFX940 __gfx940__ | ||
#elif defined(__gfx941__) | ||
#define HIPTENSOR_ARCH_GFX941 __gfx941__ | ||
#elif defined(__gfx942__) | ||
#define HIPTENSOR_ARCH_GFX942 __gfx942__ | ||
#else | ||
#define HIPTENSOR_ARCH_HOST 1 | ||
#endif | ||
|
||
#if !defined(HIPTENSOR_ARCH_GFX908) | ||
#define HIPTENSOR_ARCH_GFX908 0 | ||
#endif | ||
#if !defined(HIPTENSOR_ARCH_GFX90A) | ||
#define HIPTENSOR_ARCH_GFX90A 0 | ||
#endif | ||
#if !defined(HIPTENSOR_ARCH_GFX940) | ||
#define HIPTENSOR_ARCH_GFX940 0 | ||
#endif | ||
#if !defined(HIPTENSOR_ARCH_GFX941) | ||
#define HIPTENSOR_ARCH_GFX941 0 | ||
#endif | ||
#if !defined(HIPTENSOR_ARCH_GFX942) | ||
#define HIPTENSOR_ARCH_GFX942 0 | ||
#endif | ||
#if !defined(HIPTENSOR_ARCH_HOST) | ||
#define HIPTENSOR_ARCH_HOST 0 | ||
#endif | ||
|
||
#if defined(NDEBUG) | ||
#define HIPTENSOR_UNSUPPORTED_IMPL(MSG) | ||
#else | ||
#define HIPTENSOR_UNSUPPORTED_IMPL(MSG) __attribute__((deprecated(MSG))) | ||
#endif | ||
|
||
#if defined(HIP_NO_HALF) | ||
#define HIPTENSOR_NO_HALF 1 | ||
#else | ||
#define HIPTENSOR_NO_HALF 0 | ||
#endif // HIP_NO_HALF | ||
|
||
#if HIPTENSOR_NO_HALF || (!HIPTENSOR_NO_HALF && defined(__HIP_NO_HALF_CONVERSIONS__)) | ||
#define HIPTENSOR_TESTS_NO_HALF 1 | ||
#else | ||
#define HIPTENSOR_TESTS_NO_HALF 0 | ||
#endif // !HIPTENSOR_NO_HALF && defined(__HIP_NO_HALF_CONVERSIONS__) | ||
|
||
/// | ||
/// Host and Device symbols | ||
/// | ||
#define HIPTENSOR_DEVICE __device__ | ||
|
||
#define HIPTENSOR_HOST __host__ | ||
|
||
#define HIPTENSOR_HOST_DEVICE HIPTENSOR_HOST HIPTENSOR_DEVICE | ||
|
||
#define HIPTENSOR_KERNEL __global__ | ||
|
||
} // namespace hiptensor | ||
|
||
#endif // HIPTENSOR_CONFIG_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/******************************************************************************* | ||
* | ||
* MIT License | ||
* | ||
* Copyright (C) 2023-2024 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. | ||
* | ||
*******************************************************************************/ | ||
|
||
#ifndef HIPTENSOR_LIBRARY_DATA_TYPES_HPP | ||
#define HIPTENSOR_LIBRARY_DATA_TYPES_HPP | ||
|
||
// clang-format off | ||
// Include order needs to be preserved | ||
#include <hip/library_types.h> | ||
#include <hip/hip_bfloat16.h> | ||
#include <hip/hip_fp16.h> | ||
#include <iostream> | ||
|
||
#include <hiptensor/hiptensor_types.hpp> | ||
|
||
// clang-format on | ||
|
||
namespace hiptensor | ||
{ | ||
// Used to map to empty tensors | ||
struct NoneType; | ||
|
||
static constexpr hipDataType NONE_TYPE = (hipDataType)31; | ||
|
||
// Map type to runtime HipDataType | ||
template <typename T> | ||
struct HipDataType; | ||
|
||
template <typename T> | ||
static constexpr auto HipDataType_v = HipDataType<T>::value; | ||
|
||
// Get data size in bytes from id | ||
uint32_t hipDataTypeSize(hipDataType id); | ||
|
||
// Convert hipDataType to hiptensorComputeType_t | ||
hiptensorComputeType_t convertToComputeType(hipDataType hipType); | ||
|
||
// Read a single value from void pointer, casted to T | ||
template <typename T> | ||
T readVal(void const* value, hipDataType id); | ||
|
||
template <typename T> | ||
T readVal(void const* value, hiptensorComputeType_t id); | ||
|
||
} // namespace hiptensor | ||
|
||
bool operator==(hipDataType hipType, hiptensorComputeType_t computeType); | ||
bool operator==(hiptensorComputeType_t computeType, hipDataType hipType); | ||
|
||
bool operator!=(hipDataType hipType, hiptensorComputeType_t computeType); | ||
bool operator!=(hiptensorComputeType_t computeType, hipDataType hipType); | ||
|
||
#include "data_types_impl.hpp" | ||
|
||
#endif // HIPTENSOR_LIBRARY_DATA_TYPES_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.