Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions arm_compute/core/CL/CLHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ void set_unroll_with_pragma(CLBuildOptions &built_opts, std::initializer_list<in
*/
bool arm_matrix_multiply_supported(const cl::Device &device);

/** Helper function to check whether the cl_arm_matrix_multiply with fp16 extension is supported
*
* @param[in] device A CL device
*
* @return True if the extension is supported
*/
bool arm_matrix_multiply_fp16_supported(const cl::Device &device);

/** Check whether cl_khr_command_buffer extension is supported by the specified CL device.
*
* @param[in] device The CL device
Expand Down
4 changes: 2 additions & 2 deletions arm_compute/core/CL/OpenCL.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#if defined(__GNUG__) && __GNUG__ >= 8
#pragma GCC diagnostic ignored "-Wcatch-value"
#endif // defined(__GNUG__) && __GNUG__ >= 8
#include <CL/opencl.hpp> // include new hpp header instead of cl2.hpp
#endif // defined(__GNUG__) && __GNUG__ >= 8
#include "arm_compute/core/CL/cl_definitions.h"
#pragma GCC diagnostic pop

namespace cl
Expand Down
42 changes: 42 additions & 0 deletions arm_compute/core/CL/cl_definitions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2025 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
* 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 ACL_ARM_COMPUTE_CORE_CL_CL_DEFINITIONS_H
#define ACL_ARM_COMPUTE_CORE_CL_CL_DEFINITIONS_H

#include "include/CL/opencl.hpp"

#define CL_DEVICE_MATRIX_MULTIPLY_FP16_WITH_FP16_ACCUMULATORS_ARM (1ULL << 0)
#define CL_DEVICE_MATRIX_MULTIPLY_CAPABILITIES_ARM 0x41F4

namespace cl
{
namespace detail
{
#ifdef CL_DEVICE_MATRIX_MULTIPLY_CAPABILITIES_ARM
Comment thread
ArmDude marked this conversation as resolved.
CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_MATRIX_MULTIPLY_CAPABILITIES_ARM, cl_ulong)
#endif // CL_DEVICE_MATRIX_MULTIPLY_CAPABILITIES_ARM
} // namespace detail
} // namespace cl
#endif // ACL_ARM_COMPUTE_CORE_CL_CL_DEFINITIONS_H
1 change: 1 addition & 0 deletions arm_compute/core/GPUTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ enum class GPUTarget
G615 = 0x351,
G720 = 0x410,
G620 = 0x411,
G1 = 0x480

// When new models are added, watch out for heuristics.
// The default/unrecognized Gpu will be the latest one and
Expand Down
17 changes: 16 additions & 1 deletion src/core/CL/CLHelpers.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023 Arm Limited.
* Copyright (c) 2016-2023, 2025 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -501,6 +501,21 @@ bool arm_matrix_multiply_supported(const cl::Device &device)
return device_supports_extension(device, "cl_arm_matrix_multiply");
}

bool arm_matrix_multiply_fp16_supported(const cl::Device &device)
{
if (!arm_matrix_multiply_supported(device))
{
return false;
}

cl_ulong caps = 0;
const auto err = clGetDeviceInfo( //
device(), CL_DEVICE_MATRIX_MULTIPLY_CAPABILITIES_ARM, sizeof(caps), &caps, nullptr);

const auto supported = err == CL_SUCCESS && (caps & CL_DEVICE_MATRIX_MULTIPLY_FP16_WITH_FP16_ACCUMULATORS_ARM) != 0;
return supported;
}

bool command_buffer_supported(const cl::Device &device)
{
return device_supports_extension(device, "cl_khr_command_buffer");
Expand Down
Loading