Fix leaking memory and add enum for address spaces (#435)

Test was not cleanig up all of the kernels and programs that it creates,
which results in our driver finding that the common context still has
references when exiting. The reason for not cleaning all kernels and
programs was that it used a hard-coded constant 3 instead of the actual
number of address spaces.

This fixes the leak, and makes the code a little clearer by adding an enum
describing each address space, rather than using magic numbers.

Signed-off-by: Mats Petersson <mats.petersson@arm.com>
This commit is contained in:
Mats Petersson
2019-08-15 10:18:57 +01:00
committed by Kévin Petit
parent e6d15a2bfc
commit 93a1dc3a3a
4 changed files with 40 additions and 33 deletions

View File

@@ -16,6 +16,17 @@
#ifndef TESTS_H
#define TESTS_H
typedef enum
{
AS_Global,
AS_Private,
AS_Local,
AS_Constant,
AS_NumAddressSpaces
} AddressSpaceEnum;
extern const char *addressSpaceNames[AS_NumAddressSpaces];
int test_vload_half( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements );
int test_vloada_half( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements );