generatePTX: Convert LLVM IR code to PTX

Description Usage Arguments Value Author(s) References See Also Examples

Description

This function converts code in LLVM's IR format to PTX using libNVVM. The function can read the IR code from a file or have it be passed directly as content.

Usage

1
2
3
4
5
6
7
8
generatePTX(irCode, 
            name = if(isFile) 
                      irCode 
                   else 
                      as.character(Sys.time()),
            options = character(),
            prog = createProgram(),
           isFile = !is(irCode, "AsIs") && (length(irCode) == 1 && file.exists(irCode)))

Arguments

irCode

the name of the file containing the IR code or a character vector containing the IR code itself. If this is the code itself, we can indicate this via the isFile parameter or by passing the content within a call to I.

name

the name of the module/program

options

a character vector of options passed to compileProgram. The possible options are described in compileProgram.

prog

a nvvmProgram object used to compile the code. Often we are compiling a single block of code and so can use a new program object. When we want to combine code from different translation units/modules, we can create a program with createProgram and pass this object explicitly.

isFile

a logical value that allows the caller to explicitly indicate whether the value of irCode is the name of a file or the code itself.

Value

A string (character vector with one element) containing the PTX code. This has a class named PTXCode.

Author(s)

Duncan Temple Lang

References

libNVVM documentation

See Also

createProgram

Examples

1
2
3
f = system.file("sampleCode", "simple-gpu64.ll", package = "Rnvvm")
ptx = generatePTX(f, isFile = TRUE)
cat(ptx)

duncantl/Rnvvm documentation built on May 15, 2019, 5:56 p.m.