Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXSWHTEC-224 - Test cases ID clean up and documentation for GL Interop #94

Open
wants to merge 43 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
cea96af
SWDEV-355313 - Move catch tests and samples
gargrahul Oct 26, 2022
909e7e4
SWDEV-355313 - Add README
gargrahul Nov 7, 2022
094b9af
SWDEV-355313 - Update amd-staging branch
gargrahul Nov 28, 2022
070bb7c
EXSWHTEC-174 - Add Doxygen configuration and common header with group…
milos-mozetic Dec 1, 2022
9daa6d0
SWDEV-355313 - Update README
gargrahul Dec 2, 2022
2a205ed
EXSWHTEC-200 - Add support for TEMPLATE_TEST_CASE preprocessing
milos-mozetic Dec 5, 2022
c49043e
SWDEV-355313 - Update latest code
gargrahul Dec 6, 2022
e5e8077
EXSWHTEC-134 - Implement tests for hipGLGetDevices
mirza-halilcevic Dec 9, 2022
3e1eea8
EXSWHTEC-135 - Implement tests for hipGraphicsGLRegisterBuffer
mirza-halilcevic Dec 9, 2022
183d098
EXSWHTEC-136 - Implement tests for hipGraphicsGLRegisterImage
mirza-halilcevic Dec 9, 2022
93c1436
EXSWHTEC-137 - Implement tests for hipGraphicsMapResources
mirza-halilcevic Dec 9, 2022
e20720f
EXSWHTEC-138 - Implement tests for hipGraphicsSubResourceGetMappedArray
mirza-halilcevic Dec 9, 2022
844ac1d
EXSWHTEC-139 - Implement tests for hipGraphicsResourceGetMappedPointer
mirza-halilcevic Dec 9, 2022
34a2d2f
EXSWHTEC-140 - Implement tests for hipGraphicsUnmapResources
mirza-halilcevic Dec 9, 2022
daa6cc0
EXSWHTEC-141 - Implement tests for hipGraphicsUnregisterResource
mirza-halilcevic Dec 9, 2022
afcd051
Merge branch 'develop' into hipGraphicsUnregisterResource_tests
gargrahul Dec 13, 2022
2db594f
Merge branch 'develop' of github.com:mirza-halilcevic/hip-tests into …
milos-mozetic Dec 13, 2022
1977515
EXSWHTEC-200 - Resolve conflicts in missed conflicted files
milos-mozetic Dec 13, 2022
259be27
EXSWHTEC-200 - Add newline at the end of the file
milos-mozetic Dec 14, 2022
e0daf30
EXSWHTEC-200 - Extend the PREDEFINED list to define all macro names t…
milos-mozetic Dec 14, 2022
adb35ed
Merge remote-tracking branch 'upstream/develop' into hipGLGetDevices_…
mirza-halilcevic Dec 18, 2022
86af1b2
Merge remote-tracking branch 'origin/hipGLGetDevices_tests' into hipG…
mirza-halilcevic Dec 18, 2022
ad54b12
Merge remote-tracking branch 'origin/hipGLGetDevices_tests' into hipG…
mirza-halilcevic Dec 18, 2022
b281f78
Merge remote-tracking branch 'origin/hipGLGetDevices_tests' into hipG…
mirza-halilcevic Dec 18, 2022
52c3765
Merge remote-tracking branch 'origin/hipGLGetDevices_tests' into hipG…
mirza-halilcevic Dec 18, 2022
41270ce
Merge remote-tracking branch 'origin/hipGLGetDevices_tests' into hipG…
mirza-halilcevic Dec 18, 2022
4d0ff8a
Merge remote-tracking branch 'origin/hipGLGetDevices_tests' into hipG…
mirza-halilcevic Dec 18, 2022
6a3c580
Merge remote-tracking branch 'origin/hipGLGetDevices_tests' into hipG…
mirza-halilcevic Dec 18, 2022
2247586
Merge branch 'hipGLGetDevices_tests' of github.com:mirza-halilcevic/h…
milos-mozetic Dec 20, 2022
1604544
Merge branch 'hipGraphicsGLRegisterBuffer_tests' of github.com:mirza-…
milos-mozetic Dec 20, 2022
2142f4d
Merge branch 'hipGraphicsGLRegisterImage_tests' of github.com:mirza-h…
milos-mozetic Dec 20, 2022
9b0dfbf
Merge branch 'hipGraphicsMapResources_tests' of github.com:mirza-hali…
milos-mozetic Dec 20, 2022
a408dbf
Merge branch 'hipGraphicsSubResourceGetMappedArray_tests' of github.c…
milos-mozetic Dec 20, 2022
d61a3b0
Merge branch 'hipGraphicsResourceGetMappedPointer_tests' of github.co…
milos-mozetic Dec 20, 2022
ca9f481
Merge branch 'hipGraphicsUnmapResources_tests' of github.com:mirza-ha…
milos-mozetic Dec 20, 2022
fb33e10
Merge branch 'hipGraphicsUnregisterResource_tests' of github.com:mirz…
milos-mozetic Dec 20, 2022
cc0d5af
EXSWHTEC-224 - Test cases ID clean up and documentation for GL Interop
milos-mozetic Dec 20, 2022
dd0088c
Merge branch 'develop' into doxygen_interop_documentation
milos-mozetic Jun 22, 2023
8c60738
Merge branch 'develop' into doxygen_interop_documentation
rakesroy Jul 25, 2023
1fa6e73
Update config_amd_linux_common.json
rakesroy Jul 28, 2023
22c9d08
Merge branch 'develop' into doxygen_interop_documentation
rakesroy Jul 28, 2023
8232a8e
Merge remote-tracking branch 'upstream/develop' into doxygen_interop_…
mirza-halilcevic Feb 18, 2024
040dad1
Merge branch 'develop' into doxygen_interop_documentation
mirza-halilcevic Feb 26, 2024
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
7 changes: 7 additions & 0 deletions catch/include/hip_test_defgroups.hh
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,10 @@ THE SOFTWARE.
* This section describes tests for the Complex type functions.
* @}
*/

/**
* @defgroup GLTest Interop
* @{
* This section describes tests for the GL interop functions of HIP runtime API.
* @}
*/
51 changes: 51 additions & 0 deletions catch/unit/gl_interop/hipGLGetDevices.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,32 @@ THE SOFTWARE.

#include "gl_interop_common.hh"

/**
* @addtogroup hipGLGetDevices hipGLGetDevices
* @{
* @ingroup GLTest
* `hipGLGetDevices(unsigned int* pHipDeviceCount, int* pHipDevices,
* unsigned int hipDeviceCount, hipGLDeviceList deviceList)` -
* Queries devices associated with GL Context.
*/

namespace {
constexpr std::array<hipGLDeviceList, 3> kDeviceLists{
hipGLDeviceListAll, hipGLDeviceListCurrentFrame, hipGLDeviceListNextFrame};
} // anonymous namespace

/**
* Test Description
* ------------------------
* - Queries devices for each GL Context.
* - Expects that each GL Context return only one device.
* Test source
* ------------------------
* - unit/gl_interop/hipGLGetDevices.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGLGetDevices_Positive_Basic") {
GLContextScopeGuard gl_context;

Expand All @@ -47,6 +68,23 @@ TEST_CASE("Unit_hipGLGetDevices_Positive_Basic") {
REQUIRE(gl_devices.at(0) == 0);
}

/**
* Test Description
* ------------------------
* - Validates handling of different scenarios:
* -# When output pointer to the HIP Device count is `nullptr`
* - Expected output: return `hipSuccess`
* -# When output pointer to the HIP devices is `nullptr`
* - Expected output: return `hipSuccess`
* -# When the total number of HIP devices is 0
* - Expected output: return `hipSuccess`
* Test source
* ------------------------
* - unit/gl_interop/hipGLGetDevices.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGLGetDevices_Positive_Parameters") {
GLContextScopeGuard gl_context;

Expand All @@ -72,6 +110,19 @@ TEST_CASE("Unit_hipGLGetDevices_Positive_Parameters") {
}
}

/**
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# When device list enumeration is invalid (-1)
* - Expected output: return `hipErrorInvalidValue`
* Test source
* ------------------------
* - unit/gl_interop/hipGLGetDevices.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGLGetDevices_Negative_Parameters") {
GLContextScopeGuard gl_context;

Expand Down
53 changes: 53 additions & 0 deletions catch/unit/gl_interop/hipGraphicsGLRegisterBuffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,32 @@ THE SOFTWARE.

#include "gl_interop_common.hh"

/**
* @addtogroup hipGraphicsGLRegisterBuffer hipGraphicsGLRegisterBuffer
* @{
* @ingroup GLTest
* `hipGraphicsGLRegisterBuffer(hipGraphicsResource** resource,
* GLuint buffer, unsigned int flags)` -
* Registers a GL Buffer for interop and returns corresponding graphics resource.
*/

namespace {
constexpr std::array<unsigned int, 3> kFlags{hipGraphicsRegisterFlagsNone,
hipGraphicsRegisterFlagsReadOnly,
hipGraphicsRegisterFlagsWriteDiscard};
} // anonymous namespace

/**
* Test Description
* ------------------------
* - Registers a GL buffer for each supported register flag.
* Test source
* ------------------------
* - unit/gl_interop/hipGraphicsGLRegisterBuffer.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphicsGLRegisterBuffer_Positive_Basic") {
GLContextScopeGuard gl_context;

Expand All @@ -46,6 +66,18 @@ TEST_CASE("Unit_hipGraphicsGLRegisterBuffer_Positive_Basic") {
HIP_CHECK(hipGraphicsUnregisterResource(vbo_resource));
}

/**
* Test Description
* ------------------------
* - Registers the same GL buffer twice.
* - Stores the result in two different graphics resources.
* Test source
* ------------------------
* - unit/gl_interop/hipGraphicsGLRegisterBuffer.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphicsGLRegisterBuffer_Positive_Register_Twice") {
GLContextScopeGuard gl_context;

Expand All @@ -60,6 +92,27 @@ TEST_CASE("Unit_hipGraphicsGLRegisterBuffer_Positive_Register_Twice") {
HIP_CHECK(hipGraphicsUnregisterResource(vbo_resource_2));
}

/**
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# When output pointer to the graphics resource is `nullptr`
* - Expected output: return `hipErrorInvalidValue`
* -# When GL buffer is not valid
* - Expected output: return `hipErrorInvalidValue`
* -# When flags are not valid
* - Expected output: return `hipErrorInvalidValue`
* -# When flag is `hipGraphicsRegisterFlagsSurfaceLoadStore`
* - Expected output: return `hipErrorInvalidValue`
* -# When flag is `hipGraphicsRegisterFlagsTextureGather`
* - Expected output: return `hipErrorInvalidValue`
* Test source
* ------------------------
* - unit/gl_interop/hipGraphicsGLRegisterBuffer.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphicsGLRegisterBuffer_Negative_Parameters") {
GLContextScopeGuard gl_context;

Expand Down
53 changes: 53 additions & 0 deletions catch/unit/gl_interop/hipGraphicsGLRegisterImage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,33 @@ THE SOFTWARE.

#include "gl_interop_common.hh"

/**
* @addtogroup hipGraphicsGLRegisterImage hipGraphicsGLRegisterImage
* @{
* @ingroup GLTest
* `hipGraphicsGLRegisterImage(hipGraphicsResource** resource, GLuint image,
* GLenum target, unsigned int flags)` -
* Register a GL Image for interop and returns the corresponding graphic resource.
*/

namespace {
constexpr std::array<unsigned int, 5> kFlags{
hipGraphicsRegisterFlagsNone, hipGraphicsRegisterFlagsReadOnly,
hipGraphicsRegisterFlagsWriteDiscard, hipGraphicsRegisterFlagsSurfaceLoadStore,
hipGraphicsRegisterFlagsTextureGather};
} // anonymous namespace

/**
* Test Description
* ------------------------
* - Registers a GL image for each supported flag.
* Test source
* ------------------------
* - unit/gl_interop/hipGraphicsGLRegisterImage.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphicsGLRegisterImage_Positive_Basic") {
GLContextScopeGuard gl_context;

Expand All @@ -47,6 +67,18 @@ TEST_CASE("Unit_hipGraphicsGLRegisterImage_Positive_Basic") {
HIP_CHECK(hipGraphicsUnregisterResource(tex_resource));
}

/**
* Test Description
* ------------------------
* - Registers the same GL image twice.
* - Stores the result in two different graphics resources.
* Test source
* ------------------------
* - unit/gl_interop/hipGraphicsGLRegisterImage.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphicsGLRegisterImage_Positive_Register_Twice") {
GLContextScopeGuard gl_context;

Expand All @@ -63,6 +95,27 @@ TEST_CASE("Unit_hipGraphicsGLRegisterImage_Positive_Register_Twice") {
HIP_CHECK(hipGraphicsUnregisterResource(tex_resource_2));
}

/**
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# When output pointer to the graphics resource is `nullptr`
* - Expected output: return `hipErrorInvalidValue`
* -# When GL image is not valid
* - Expected output: return `hipErrorInvalidValue`
* -# When target is not valid - buffer instead of image
* - Expected output: return `hipErrorInvalidValue`
* -# When target does not match the object
* - Expected output: return `hipErrorInvalidValue`
* -# When flags are not valid
* - Expected output: return `hipErrorInvalidValue`
* Test source
* ------------------------
* - unit/gl_interop/hipGraphicsGLRegisterImage.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphicsGLRegisterImage_Negative_Parameters") {
GLContextScopeGuard gl_context;

Expand Down
43 changes: 43 additions & 0 deletions catch/unit/gl_interop/hipGraphicsMapResources.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@ THE SOFTWARE.

#include "gl_interop_common.hh"

/**
* @addtogroup hipGraphicsMapResources hipGraphicsMapResources
* @{
* @ingroup GLTest
* `hipGraphicsMapResources(int count, hipGraphicsResource_t* resources,
* hipStream_t stream __dparm(0) )` -
* Maps a graphics resource for hip access.
*/

/**
* Test Description
* ------------------------
* - Maps graphics resources for HIP access:
* - GL buffer
* - GL image
* Test source
* ------------------------
* - unit/gl_interop/hipGraphicsMapResources.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphicsMapResources_Positive_Basic") {
GLContextScopeGuard gl_context;

Expand All @@ -51,6 +73,27 @@ TEST_CASE("Unit_hipGraphicsMapResources_Positive_Basic") {
HIP_CHECK(hipGraphicsUnregisterResource(resources.at(1)));
}

/**
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# When resources count is 0
* - Expected output: return `hipErrorInvalidValue`
* -# When resources array is `nullptr`
* - Expected output: return `hipErrorInvalidValue`
* -# When resources are not registered
* - Expected output: return `hipErrorInvalidHandle`
* -# When resources are already mapped
* - Expected output: return `hipErrorAlreadyMapped`
* -# When the stream is not valid
* - Expected output: return `hipErrorContextIsDestroyed`
* Test source
* ------------------------
* - unit/gl_interop/hipGraphicsMapResources.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphicsMapResources_Negative_Parameters") {
GLContextScopeGuard gl_context;

Expand Down
56 changes: 56 additions & 0 deletions catch/unit/gl_interop/hipGraphicsResourceGetMappedPointer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ THE SOFTWARE.

#include "gl_interop_common.hh"

/**
* @addtogroup hipGraphicsResourceGetMappedPointer hipGraphicsResourceGetMappedPointer
* @{
* @ingroup GLTest
* `hipGraphicsResourceGetMappedPointer(void** devPtr, size_t* size,
* hipGraphicsResource_t resource)` -
* Gets device accessible address of a graphics resource.
*/

/**
* Test Description
* ------------------------
* - Gets device accessible address of a graphics resource.
* - Validates that the device accessible address is not `nullptr`.
* Test source
* ------------------------
* - unit/gl_interop/hipGraphicsResourceGetMappedPointer.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphicsResourceGetMappedPointer_Positive_Basic") {
GLContextScopeGuard gl_context;

Expand All @@ -51,6 +72,22 @@ TEST_CASE("Unit_hipGraphicsResourceGetMappedPointer_Positive_Basic") {
HIP_CHECK(hipGraphicsUnregisterResource(vbo_resource));
}

/**
* Test Description
* ------------------------
* - Validates handling of different scenarios:
* -# When output pointer to the device accessible address is `nullptr`.
* - Expected output: return `hipSuccess`
* -# When size is `nullptr`
* - Expected output: return `hipSuccess`
* - Device accessible address is not `nullptr`
* Test source
* ------------------------
* - unit/gl_interop/hipGraphicsResourceGetMappedPointer.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphicsResourceGetMappedPointer_Positive_Parameters") {
GLContextScopeGuard gl_context;

Expand Down Expand Up @@ -81,6 +118,25 @@ TEST_CASE("Unit_hipGraphicsResourceGetMappedPointer_Positive_Parameters") {
HIP_CHECK(hipGraphicsUnregisterResource(vbo_resource));
}

/**
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# When resource is non-pointer
* - Expected output: return `hipErrorNotMappedAsPointer`
* -# When resource is unregistered
* - Expected output: return `hipErrorContextIsDestroyed`
* -# When resource is not mapped
* - Expected output: return `hipErrorNotMapped`
* -# When resource is unmapped
* - Expected output: return `hipErrorNotMapped`
* Test source
* ------------------------
* - unit/gl_interop/hipGraphicsResourceGetMappedPointer.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphicsResourceGetMappedPointer_Negative_Parameters") {
GLContextScopeGuard gl_context;

Expand Down
Loading