Skip to content

Commit c6f1b4f

Browse files
Added 2 descriptors: max_mem_alloc_size, max_clock_frequency
Added DPCTLDevice_GetMaxMemAllocSize, and DPCTLDevice_GetMaxClockFrequency.
1 parent c4069a4 commit c6f1b4f

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

libsyclinterface/include/dpctl_sycl_device_interface.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,28 @@ DPCTL_API
709709
uint32_t DPCTLDevice_GetGlobalMemCacheLineSize(
710710
__dpctl_keep const DPCTLSyclDeviceRef DRef);
711711

712+
/*!
713+
* @brief Wrapper over
714+
* device.get_info<info::device::max_clock_frequency>
715+
*
716+
* @param DRef Opaque pointer to a sycl::device
717+
* @return Returns the maximum clock frequency in MHz as uint32_t.
718+
*/
719+
DPCTL_API
720+
uint32_t
721+
DPCTLDevice_GetMaxClockFrequency(__dpctl_keep const DPCTLSyclDeviceRef DRef);
722+
723+
/*!
724+
* @brief Wrapper over
725+
* device.get_info<info::device::max_mem_alloc_size>
726+
*
727+
* @param DRef Opaque pointer to a sycl::device
728+
* @return Returns the maximum size of memory object in bytes as uint64_t.
729+
*/
730+
DPCTL_API
731+
uint64_t
732+
DPCTLDevice_GetMaxMemAllocSize(__dpctl_keep const DPCTLSyclDeviceRef DRef);
733+
712734
/*!
713735
* @brief Wrapper over
714736
* device.get_info<info::device::global_mem_cache_size>

libsyclinterface/source/dpctl_sycl_device_interface.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,32 @@ uint32_t DPCTLDevice_GetGlobalMemCacheLineSize(
718718
}
719719
}
720720

721+
uint32_t
722+
DPCTLDevice_GetMaxClockFrequency(__dpctl_keep const DPCTLSyclDeviceRef DRef)
723+
{
724+
if (DRef) {
725+
auto D = unwrap<device>(DRef);
726+
return D->get_info<info::device::max_clock_frequency>();
727+
}
728+
else {
729+
error_handler("Argument DRef is null", __FILE__, __func__, __LINE__);
730+
return 0;
731+
}
732+
}
733+
734+
uint64_t
735+
DPCTLDevice_GetMaxMemAllocSize(__dpctl_keep const DPCTLSyclDeviceRef DRef)
736+
{
737+
if (DRef) {
738+
auto D = unwrap<device>(DRef);
739+
return D->get_info<info::device::max_mem_alloc_size>();
740+
}
741+
else {
742+
error_handler("Argument DRef is null", __FILE__, __func__, __LINE__);
743+
return 0;
744+
}
745+
}
746+
721747
uint64_t
722748
DPCTLDevice_GetGlobalMemCacheSize(__dpctl_keep const DPCTLSyclDeviceRef DRef)
723749
{

libsyclinterface/tests/test_sycl_device_interface.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,13 @@ TEST_P(TestDPCTLSyclDeviceInterface, ChkGetProfilingTimerResolution)
495495
EXPECT_TRUE(res != 0);
496496
}
497497

498+
TEST_P(TestDPCTLSyclDeviceInterface, ChkGetMaxMemAllocSize)
499+
{
500+
uint64_t res = 0;
501+
EXPECT_NO_FATAL_FAILURE(res = DPCTLDevice_GetMaxMemAllocSize(DRef));
502+
EXPECT_TRUE(res != 0);
503+
}
504+
498505
TEST_P(TestDPCTLSyclDeviceInterface, ChkGetGlobalMemCacheSize)
499506
{
500507
uint64_t res = 0;
@@ -509,6 +516,13 @@ TEST_P(TestDPCTLSyclDeviceInterface, ChkGetGlobalMemCacheLineSize)
509516
EXPECT_TRUE(res != 0);
510517
}
511518

519+
TEST_P(TestDPCTLSyclDeviceInterface, ChkGetGetMaxClockFrequency)
520+
{
521+
uint32_t res = 0;
522+
EXPECT_NO_FATAL_FAILURE(res = DPCTLDevice_GetMaxClockFrequency(DRef));
523+
EXPECT_TRUE(res != 0);
524+
}
525+
512526
TEST_P(TestDPCTLSyclDeviceInterface, ChkGetGlobalMemCacheType)
513527
{
514528
DPCTLGlobalMemCacheType res = DPCTL_MEM_CACHE_TYPE_INDETERMINATE;
@@ -833,6 +847,13 @@ TEST_F(TestDPCTLSyclDeviceNullArgs, ChkGetProfilingTimerResolution)
833847
ASSERT_TRUE(res == 0);
834848
}
835849

850+
TEST_F(TestDPCTLSyclDeviceNullArgs, ChkGetMaxMemAllocSize)
851+
{
852+
uint64_t res = 1;
853+
EXPECT_NO_FATAL_FAILURE(res = DPCTLDevice_GetMaxMemAllocSize(Null_DRef));
854+
ASSERT_TRUE(res == 0);
855+
}
856+
836857
TEST_F(TestDPCTLSyclDeviceNullArgs, ChkGetGlobalMemCacheSize)
837858
{
838859
uint64_t res = 1;
@@ -848,6 +869,13 @@ TEST_F(TestDPCTLSyclDeviceNullArgs, ChkGetGlobalMemCacheLineSize)
848869
ASSERT_TRUE(res == 0);
849870
}
850871

872+
TEST_F(TestDPCTLSyclDeviceNullArgs, ChkGetMaxClockFrequency)
873+
{
874+
uint32_t res = 1;
875+
EXPECT_NO_FATAL_FAILURE(res = DPCTLDevice_GetMaxClockFrequency(Null_DRef));
876+
ASSERT_TRUE(res == 0);
877+
}
878+
851879
TEST_F(TestDPCTLSyclDeviceNullArgs, ChkGetGlobalMemCacheType)
852880
{
853881
DPCTLGlobalMemCacheType res = DPCTL_MEM_CACHE_TYPE_NONE;

0 commit comments

Comments
 (0)