Skip to content

Commit 7b56ef5

Browse files
committed
[Comgr] Port isa_name_parsing_test to LIT and add SPIR-V identifier coverage
Ported isa_name_parsing_test from CTest to LIT. Adjusted CMakeList.txt files appropriately.
1 parent 3f965cd commit 7b56ef5

6 files changed

Lines changed: 58 additions & 79 deletions

File tree

amd/comgr/src/comgr.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,6 @@ amd_comgr_status_t COMGR::parseTargetIdentifier(StringRef IdentStr,
248248
Ident.Features.erase(Ident.Features.begin());
249249

250250

251-
// TODO: Add a LIT test for this
252-
if (IdentStr == "spirv64-amd-amdhsa--amdgcnspirv" ||
253-
IdentStr == "spirv64-amd-amdhsa-unknown-amdgcnspirv") {
254-
// Features not supported for SPIR-V
255-
if (!Ident.Features.empty())
256-
return AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT;
257-
return AMD_COMGR_STATUS_SUCCESS;
258-
}
259-
260251
size_t IsaIndex;
261252
amd_comgr_status_t Status = metadata::getIsaIndex(IdentStr, IsaIndex);
262253
if (Status != AMD_COMGR_STATUS_SUCCESS) {

amd/comgr/test-lit/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,6 @@ add_comgr_lit_binary(status-string c)
5454
add_comgr_lit_binary(data-action c)
5555
add_comgr_lit_binary(lookup-code-object c)
5656
add_comgr_lit_binary(hotswap-rewrite c)
57+
add_comgr_lit_binary(parse-isa-name c)
5758

5859
add_dependencies(check-comgr test-lit)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//===- parse-isa-name.c ------------------------------------------------------===//
2+
//
3+
// Part of Comgr, under the Apache License v2.0 with LLVM Exceptions. See
4+
// amd/comgr/LICENSE.TXT in this repository for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "amd_comgr.h"
10+
#include "common.h"
11+
12+
int main(int argc, char *argv[]) {
13+
amd_comgr_action_info_t DataAction;
14+
amd_comgr_status_t Status;
15+
const char *reason = "";
16+
17+
if (argc != 3) {
18+
fprintf(stderr, "Usage: parse-isa-name <isa-name> <expected-status>\n");
19+
exit(1);
20+
}
21+
amd_comgr_(create_action_info(&DataAction));
22+
Status = amd_comgr_action_info_set_isa_name(DataAction, argv[1]);
23+
amd_comgr_status_string(Status, &reason);
24+
if (strcmp(reason, argv[2])) {
25+
fail("INVALID: %s\n", reason);
26+
}
27+
else
28+
printf("OK\n");
29+
return 0;
30+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// COM: Test Comgr parse-isa-name() API
2+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx803" SUCCESS
3+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx803" SUCCESS
4+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx801:xnack+" SUCCESS
5+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx801:xnack-" SUCCESS
6+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx908:sramecc+" SUCCESS
7+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx908:sramecc-" SUCCESS
8+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx908:xnack+:sramecc+" SUCCESS
9+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx908:xnack-:sramecc+" SUCCESS
10+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx908:xnack-:sramecc-" SUCCESS
11+
// RUN: parse-isa-name "spir64-amd-amdhsa--amdgcnspirv" SUCCESS
12+
// RUN: parse-isa-name "spir64-amd-amdhsa-unknown-amdgcnspirv" SUCCESS
13+
14+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx1010:xnack+" SUCCESS
15+
// RUN: parse-isa-name "" SUCCESS
16+
17+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx801:xnack+:sramecc+" INVALID_ARGUMENT
18+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx803:::" INVALID_ARGUMENT
19+
// RUN: parse-isa-name "amdgcn-amd-amdhsa-opencl-gfx803" INVALID_ARGUMENT
20+
// RUN: parse-isa-name "amdgcn-amd-amdhsa-gfx803" INVALID_ARGUMENT
21+
// RUN: parse-isa-name "gfx803" INVALID_ARGUMENT
22+
// RUN: parse-isa-name " amdgcn-amd-amdhsa--gfx803" INVALID_ARGUMENT
23+
// RUN: parse-isa-name " amdgcn-amd-amdhsa--gfx803 " INVALID_ARGUMENT
24+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx803 " INVALID_ARGUMENT
25+
// RUN: parse-isa-name " amdgcn-amd-amdhsa--gfx803 " INVALID_ARGUMENT
26+
// RUN: parse-isa-name "amdgcn-amd-amdhsa--gfx803 " INVALID_ARGUMENT
27+
// RUN: parse-isa-name "spirv64-amd-amdhsa--amdgcnspirv:xnack+" INVALID_ARGUMENT

amd/comgr/test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ add_comgr_test(compile_source_with_device_libs_to_bc_test c)
230230
add_comgr_test(compile_source_with_device_libs_to_bc_with_vfs_test c)
231231
add_comgr_test(assemble_test c)
232232
add_comgr_test(link_test c)
233-
add_comgr_test(isa_name_parsing_test c)
234233
add_comgr_test(get_data_isa_name_test c)
235234
add_comgr_test(include_subdirectory_test c)
236235
add_comgr_test(demangle_test c)

amd/comgr/test/isa_name_parsing_test.c

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)