createProgram: Functions to process a libNVVM program

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

Description

These functions allow us to use libNVVM to convert LLVM Intermediate Representation (IR) code to PTX code that we can use with CUDA. These allow us to create a program object, to add IR code to the program and to compile the code to PTX. These are the primitives building blocks. generatePTX uses these to implement the full sequence of converting IR code to PTX.

The functions allow us to both compile the PTX and also to retrieve errors about the compilation (getProgramLog).

Usage

1
2
3
4
5
6
createProgram()
addModuleToProgram(prog, buffer, name = "", size = nchar(buffer))
compileProgram(prog, options, numOptions = length(as(options, "character"))) 
verifyProgram(prog, options, numOptions = length(as(options, "character")))
getCompiledResultSize(prog)
getProgramLogSize(prog)

Arguments

prog

a nvvmProgram object, created with createProgram.

buffer

a character vector containing the IR code to be converted to PTX

name

the name to use for the PTX module name

size

the number of bytes in the bufer

options

a character vector

numOptions

this should never be specified by the caller

Value

Each of the functions return differen information. verifyProgram checks whether function

Author(s)

Duncan Temple Lang

References

libNVVM

See Also

generatePTX

Examples

1
2
3
4
5
6
7
f = system.file("sampleCode", "simple-gpu64.ll", package = "Rnvvm")
ir = readLines(f)
prog = createProgram()
addModuleToProgram(prog, ir, "example")
compileProgram(prog, character())
n = getCompiledResultSize(prog)
ptx = getCompiledResult(prog, n)

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