libNVVM API (PDF) - v6.0 (older) - Last updated February 13, 2014 - Send Feedback -

## 1.3. Compilation

### Typedefs

typedef _nvvmProgram * nvvmProgram
  NVVM Program.

### Functions

nvvmResult nvvmAddModuleToProgram ( nvvmProgram prog, const char* buffer, size_t size, const char* name )
  Add a module level NVVM IR to a program.
nvvmResult nvvmCompileProgram ( nvvmProgram prog, int numOptions, const char** options )
  Compile the NVVM program.
nvvmResult nvvmCreateProgram ( nvvmProgram* prog )
  Create a program, and set the value of its handle to *prog.
nvvmResult nvvmDestroyProgram ( nvvmProgram* prog )
  Destroy a program.
nvvmResult nvvmGetCompiledResult ( nvvmProgram prog, char* buffer )
  Get the compiled result.
nvvmResult nvvmGetCompiledResultSize ( nvvmProgram prog, size_t* bufferSizeRet )
  Get the size of the compiled result.
nvvmResult nvvmGetProgramLog ( nvvmProgram prog, char* buffer )
  Get the Compiler/Verifier Message.
nvvmResult nvvmGetProgramLogSize ( nvvmProgram prog, size_t* bufferSizeRet )
  Get the Size of Compiler/Verifier Message.
nvvmResult nvvmVerifyProgram ( nvvmProgram prog, int numOptions, const char** options )
  Verify the NVVM program.

### Typedefs

typedef _nvvmProgram * nvvmProgram

  NVVM Program. An opaque handle for a program

### Functions

nvvmResult nvvmAddModuleToProgram ( nvvmProgram prog, const char* buffer, size_t size, const char* name )
  Add a module level NVVM IR to a program.

  ###### Parameters

  `prog`
    NVVM program.
  `buffer`
    NVVM IR module in the bitcode or text representation.
  `size`
    Size of the NVVM IR module.
  `name`
    Name of the NVVM IR module. If NULL, "<unnamed>" is used as the name.

  ###### Returns

  - NVVM_SUCCESS
  - NVVM_ERROR_OUT_OF_MEMORY
  - NVVM_ERROR_INVALID_INPUT
  - NVVM_ERROR_INVALID_PROGRAM

  ###### Description

  The buffer should contain an NVVM IR module either in the bitcode representation or in the text representation.

nvvmResult nvvmCompileProgram ( nvvmProgram prog, int numOptions, const char** options )
  Compile the NVVM program.

  ###### Parameters

  `prog`
    NVVM program.
  `numOptions`
    Number of compiler options passed.
  `options`
    Compiler options in the form of C string array.

  ###### Returns

  - NVVM_SUCCESS
  - NVVM_ERROR_OUT_OF_MEMORY
  - NVVM_ERROR_IR_VERSION_MISMATCH
  - NVVM_ERROR_INVALID_PROGRAM
  - NVVM_ERROR_INVALID_IR
  - NVVM_ERROR_INVALID_OPTION
  - NVVM_ERROR_NO_MODULE_IN_PROGRAM
  - NVVM_ERROR_COMPILATION

  ###### Description

  The valid compiler options are:

  - -g (enable generation of debugging information)

  - -opt=

    - 0 (disable optimizations)

    - 3 (default, enable optimizations)

  - -arch=

    - compute_20 (default)

    - compute_30

    - compute_35

  - -ftz=

    - 0 (default, preserve denormal values, when performing single-precision floating-point operations)

    - 1 (flush denormal values to zero, when performing single-precision floating-point operations)

  - -prec-sqrt=

    - 0 (use a faster approximation for single-precision floating-point square root)

    - 1 (default, use IEEE round-to-nearest mode for single-precision floating-point square root)

  - -prec-div=

    - 0 (use a faster approximation for single-precision floating-point division and reciprocals)

    - 1 (default, use IEEE round-to-nearest mode for single-precision floating-point division and reciprocals)

  - -fma=

    - 0 (disable FMA contraction)

    - 1 (default, enable FMA contraction)

nvvmResult nvvmCreateProgram ( nvvmProgram* prog )
  Create a program, and set the value of its handle to *prog.

  ###### Parameters

  `prog`
    NVVM program.

  ###### Returns

  - NVVM_SUCCESS
  - NVVM_ERROR_OUT_OF_MEMORY
  - NVVM_ERROR_INVALID_PROGRAM

  ###### Description

  See also:

  nvvmDestroyProgram()

nvvmResult nvvmDestroyProgram ( nvvmProgram* prog )
  Destroy a program.

  ###### Parameters

  `prog`
    NVVM program.

  ###### Returns

  - NVVM_SUCCESS
  - NVVM_ERROR_INVALID_PROGRAM

  ###### Description

  See also:

  nvvmCreateProgram()

nvvmResult nvvmGetCompiledResult ( nvvmProgram prog, char* buffer )
  Get the compiled result.

  ###### Parameters

  `prog`
    NVVM program.
  `buffer`
    Compiled result.

  ###### Returns

  - NVVM_SUCCESS
  - NVVM_ERROR_INVALID_PROGRAM

  ###### Description

  The result is stored in the memory pointed by 'buffer'.

nvvmResult nvvmGetCompiledResultSize ( nvvmProgram prog, size_t* bufferSizeRet )
  Get the size of the compiled result.

  ###### Parameters

  `prog`
    NVVM program.
  `bufferSizeRet`
    Size of the compiled result (including the trailing NULL).

  ###### Returns

  - NVVM_SUCCESS
  - NVVM_ERROR_INVALID_PROGRAM

  ###### Description

nvvmResult nvvmGetProgramLog ( nvvmProgram prog, char* buffer )
  Get the Compiler/Verifier Message.

  ###### Parameters

  `prog`
    NVVM program program.
  `buffer`
    Compilation/Verification log.

  ###### Returns

  - NVVM_SUCCESS
  - NVVM_ERROR_INVALID_PROGRAM

  ###### Description

  The NULL terminated message string is stored in the memory pointed by 'buffer' when the return value is NVVM_SUCCESS.

nvvmResult nvvmGetProgramLogSize ( nvvmProgram prog, size_t* bufferSizeRet )
  Get the Size of Compiler/Verifier Message.

  ###### Parameters

  `prog`
    NVVM program.
  `bufferSizeRet`
    Size of the compilation/verification log (including the trailing NULL).

  ###### Returns

  - NVVM_SUCCESS
  - NVVM_ERROR_INVALID_PROGRAM

  ###### Description

  The size of the message string (including the trailing NULL) is stored into 'buffer_size_ret' when the return value is NVVM_SUCCESS.

nvvmResult nvvmVerifyProgram ( nvvmProgram prog, int numOptions, const char** options )
  Verify the NVVM program.

  ###### Parameters

  `prog`
    NVVM program.
  `numOptions`
    Number of compiler options passed.
  `options`
    Compiler options in the form of C string array.

  ###### Returns

  - NVVM_SUCCESS
  - NVVM_ERROR_OUT_OF_MEMORY
  - NVVM_ERROR_IR_VERSION_MISMATCH
  - NVVM_ERROR_INVALID_PROGRAM
  - NVVM_ERROR_INVALID_IR
  - NVVM_ERROR_INVALID_OPTION
  - NVVM_ERROR_NO_MODULE_IN_PROGRAM

  ###### Description

  The valid compiler options are:

  NONE. The `numOptions` and `options` parameters are ignored, and are for future use.