brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.4 KiB · b472236 Raw
162 lines · plain
1//===-- Common.td - Common definitions for Offload ---------*- tablegen -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// This file contains shared Offload API definitions10//11//===----------------------------------------------------------------------===//12 13def OL_VERSION_MAJOR : Macro {14  let desc = "Major version of the Offload API";15  let value = "0";16}17 18def OL_VERSION_MINOR : Macro {19  let desc = "Minor version of the Offload API";20  let value = "0";21}22 23def OL_VERSION_PATCH : Macro {24  let desc = "Patch version of the Offload API";25  let value = "1";26}27 28def OL_APICALL : Macro {29  let desc = "Calling convention for all API functions";30  let condition = "defined(_WIN32)";31  let value = "__cdecl";32  let alt_value = "";33}34 35def OL_APIEXPORT : Macro {36  let desc = "Microsoft-specific dllexport storage-class attribute";37  let condition = "defined(_WIN32)";38  let value = "__declspec(dllexport)";39  let alt_value = "";40}41 42def ol_platform_handle_t : Handle {43  let desc = "Handle of a platform instance";44}45 46def ol_device_handle_t : Handle {47  let desc = "Handle of platform's device object";48}49 50def ol_context_handle_t : Handle {51  let desc = "Handle of context object";52}53 54def ol_queue_handle_t : Handle {55  let desc = "Handle of queue object";56}57 58def ol_event_handle_t : Handle {59  let desc = "Handle of event object";60}61 62def ol_program_handle_t : Handle {63  let desc = "Handle of program object";64}65 66def ol_symbol_handle_t : Handle {67  let desc = "Handle of an object in a device's memory for a specific program";68}69 70def ol_errc_t : Enum {71  let desc = "Defines Return/Error codes";72  let etors =[73    Etor<"SUCCESS", "success">,74 75    // Universal errors76    Etor<"UNKNOWN", "unknown or internal error">,77    Etor<"HOST_IO", "I/O error on host">,78    Etor<"INVALID_BINARY", "a provided binary image is malformed">,79    Etor<"INVALID_NULL_POINTER", "a pointer argument is null when it should not be">,80    Etor<"INVALID_ARGUMENT", "an argument is invalid">,81    Etor<"NOT_FOUND", "requested object was not found in the binary image">,82    Etor<"OUT_OF_RESOURCES", "out of resources">,83    Etor<"INVALID_SIZE", "invalid size or dimensions (e.g., must not be zero, or is out of bounds)">,84    Etor<"INVALID_ENUMERATION", "enumerator argument is not valid">,85    Etor<"HOST_TOOL_NOT_FOUND", "a required binary (linker, etc.) was not found on the host">,86    Etor<"INVALID_VALUE", "invalid value">,87    Etor<"UNIMPLEMENTED", "generic error code for features currently unimplemented by the device/backend">,88    Etor<"UNSUPPORTED", "generic error code for features unsupported by the device/backend">,89    Etor<"ASSEMBLE_FAILURE", "assembler failure while processing binary image">,90    Etor<"COMPILE_FAILURE", "jit compile failure while processing binary image">,91    Etor<"LINK_FAILURE", "linker failure while processing binary image">,92    Etor<"BACKEND_FAILURE", "the plugin backend is in an invalid or unsupported state">,93    Etor<"UNINITIALIZED", "not initialized">,94 95    // Handle related errors - only makes sense for liboffload96    Etor<"INVALID_NULL_HANDLE", "a handle argument is null when it should not be">,97    Etor<"INVALID_PLATFORM", "invalid platform">,98    Etor<"INVALID_DEVICE", "invalid device">,99    Etor<"INVALID_QUEUE", "invalid queue">,100    Etor<"INVALID_EVENT", "invalid event">,101    Etor<"SYMBOL_KIND", "the operation does not support this symbol kind">,102  ];103}104 105def ol_error_struct_t : Struct {106  let desc = "Details of the error condition returned by an API call";107  let members = [108    StructMember<"ol_errc_t", "Code", "The error code">,109    StructMember<"const char*", "Details", "String containing error details">110  ];111}112 113def ol_result_t : Typedef {114  let desc = "Result type returned by all entry points.";115  let value = "const struct ol_error_struct_t*";116}117 118def OL_SUCCESS : Macro {119  let desc = "Success condition";120  let value = "NULL";121}122 123def ol_code_location_t : Struct {124  let desc = "Code location information that can optionally be associated with an API call";125  let members = [126    StructMember<"const char*", "FunctionName", "Function name">,127    StructMember<"const char*", "SourceFile", "Source code file">,128    StructMember<"uint32_t", "LineNumber", "Source code line number">,129    StructMember<"uint32_t", "ColumnNumber", "Source code column number">130  ];131}132 133def ol_dimensions_t : Struct {134  let desc = "A three element vector";135  let members = [136    StructMember<"uint32_t", "x", "X">,137    StructMember<"uint32_t", "y", "Y">,138    StructMember<"uint32_t", "z", "Z">,139  ];140}141 142def olInit : Function {143  let desc = "Perform initialization of the Offload library";144  let details = [145    "This must be the first API call made by a user of the Offload library",146    "The underlying platforms are lazily initialized on their first use"147    "Each call will increment an internal reference count that is decremented by `olShutDown`"148  ];149  let params = [];150  let returns = [];151}152 153def olShutDown : Function {154  let desc = "Release the resources in use by Offload";155  let details = [156    "This decrements an internal reference count. When this reaches 0, all resources will be released",157    "Subsequent API calls to methods other than `olInit` made after resources are released will return OL_ERRC_UNINITIALIZED"158  ];159  let params = [];160  let returns = [];161}162