[PATCH] D114367: [NVPTX] Auto-generate tests for sufrace and texture instructions

Andrew Savonichev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 22 13:18:19 PST 2021


asavonic added a comment.

In D114367#3147070 <https://reviews.llvm.org/D114367#3147070>, @tra wrote:

> Awsome! I'll go over the script in a couple of days. 
> Meanwhile, could you post a representative example of the code this file generates?
>
> BTW, how many instruction variants does it generate and how long does it take to run the test?

Currently the test takes ~2 seconds on my machine.
There are 508 unique variants, but some are duplicated for `cuda` and `nvcl` triples, so there are total 847 test cases.
I think we can improve this, I'll post an update tomorrow.

  target triple = "nvptx-unknown-cuda"
  
  declare i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)*)
  @gsurf = internal addrspace(1) global i64 0, align 8
  @gtex = internal addrspace(1) global i64 1, align 8
  
  ;; access: i32 %x
  ;; instruction: suld.b.1d.b8.trap
  ;; retty: i16
  ;; reg_access: {%r{{[0-9]}}}
  ;; test_name: test_suld_1db8trap
  ;; global_surf: gsurf
  ;; intrinsic: llvm.nvvm.suld.1d.i8.trap
  ;; reg_surf: %rd{{[0-9]+}}
  ;; reg_ret: {%rs{{[0-9]+}}}
  
  declare i16 @llvm.nvvm.suld.1d.i8.trap(i64 %s, i32 %x);
  
  ; CHECK-LABEL: .func test_suld_1db8trap_index
  ; CHECK: suld.b.1d.b8.trap {%rs{{[0-9]+}}}, [%rd{{[0-9]+}}, {%r{{[0-9]}}}]
  ;
  define void @test_suld_1db8trap_index(i64 %s, i16* %ret, i32 %x) {
    %val = tail call i16 @llvm.nvvm.suld.1d.i8.trap(i64 %s, i32 %x)
    store i16 %val, i16* %ret
    ret void
  }
  ; CHECK-LABEL: .func test_suld_1db8trap_global
  ; CHECK: suld.b.1d.b8.trap {%rs{{[0-9]+}}}, [gsurf, {%r{{[0-9]}}}]
  ;
  define void @test_suld_1db8trap_global(i64 %s, i16* %ret, i32 %x) {
    %gs = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)* @gsurf)
    %val = tail call i16 @llvm.nvvm.suld.1d.i8.trap(i64 %gs, i32 %x)
    store i16 %val, i16* %ret
    ret void
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114367/new/

https://reviews.llvm.org/D114367



More information about the llvm-commits mailing list