Skip to content

Using the rules

spv_library

load("@rules_sycl_docs//:user_docs.bzl", "spv_library")

spv_library(name, deps, srcs, copts, defines, includes)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps - List of labels optional []
srcs - List of labels required
copts Add these options to the CUDA device compilation command. List of strings optional []
defines List of defines to add to the compile line. List of strings optional []
includes List of include dirs to be added to the compile line. List of strings optional []

icx_cc_binary

load("@rules_sycl_docs//:user_docs.bzl", "icx_cc_binary")

icx_cc_binary(name, kwargs)

A macro to create a cc_binary with icx toolchain.

It adds "icx" feature and requires_sycl() to the target_compatible_with.

PARAMETERS

Name Description Default Value
name the name of the target. none
kwargs additional keyword arguments passed to cc_binary. none

icx_cc_library

load("@rules_sycl_docs//:user_docs.bzl", "icx_cc_library")

icx_cc_library(name, kwargs)

A macro to create a cc_library with icx toolchain.

It adds "icx" feature and requires_sycl() to the target_compatible_with.

PARAMETERS

Name Description Default Value
name the name of the target. none
kwargs additional keyword arguments passed to cc_library. none

icx_cc_test

load("@rules_sycl_docs//:user_docs.bzl", "icx_cc_test")

icx_cc_test(name, kwargs)

A macro to create a cc_test with icx toolchain.

It adds "icx" feature and requires_sycl() to the target_compatible_with.

PARAMETERS

Name Description Default Value
name the name of the target. none
kwargs additional keyword arguments passed to cc_test. none

requires_sycl

load("@rules_sycl_docs//:user_docs.bzl", "requires_sycl")

requires_sycl()

Returns constraint_setting that is satisfied if:

  • rules are enabled and
  • a valid toolchain is configured.

Add to 'target_compatible_with' attribute to mark a target incompatible when the conditions are not satisfied. Incompatible targets are excluded from bazel target wildcards and fail to build if requested explicitly.

rules_sycl_dependencies

load("@rules_sycl_docs//:user_docs.bzl", "rules_sycl_dependencies")

rules_sycl_dependencies()

Populate the dependencies for rules_sycl. This will setup other bazel rules as workspace dependencies

rules_sycl_toolchains

load("@rules_sycl_docs//:user_docs.bzl", "rules_sycl_toolchains")

rules_sycl_toolchains(name, toolkit_path, version, register_toolchains)

Populate the @sycl repo.

PARAMETERS

Name Description Default Value
name must be "sycl". "sycl"
toolkit_path Optionally specify the path to SYCL toolkit. If not specified, it will be detected automatically. None
version str for sycl toolkit version. Required for deliverable toolkit only. None
register_toolchains Register the toolchains if enabled. False

sycl_binary

load("@rules_sycl_docs//:user_docs.bzl", "sycl_binary")

sycl_binary(name, kwargs)

A macro to create a cc_binary with icx toolchain.

It adds "icx" feature and requires_sycl() to the target_compatible_with.

PARAMETERS

Name Description Default Value
name the name of the target. none
kwargs additional keyword arguments passed to cc_binary. none

sycl_library

load("@rules_sycl_docs//:user_docs.bzl", "sycl_library")

sycl_library(name, kwargs)

A macro to create a cc_library with icx toolchain.

It adds "icx" feature and requires_sycl() to the target_compatible_with.

PARAMETERS

Name Description Default Value
name the name of the target. none
kwargs additional keyword arguments passed to cc_library. none

sycl_test

load("@rules_sycl_docs//:user_docs.bzl", "sycl_test")

sycl_test(name, kwargs)

A macro to create a cc_test with icx toolchain.

It adds "icx" feature and requires_sycl() to the target_compatible_with.

PARAMETERS

Name Description Default Value
name the name of the target. none
kwargs additional keyword arguments passed to cc_test. none

sycl_toolkit

load("@rules_sycl_docs//:user_docs.bzl", "sycl_toolkit")

sycl_toolkit(name, repo_mapping, toolkit_path, version)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this repository. Name required
repo_mapping In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension's implementation function).
Dictionary: String -> String optional
toolkit_path Path to the oneAPI SDK, if empty the environment variable CMPLR_ROOT will be used to deduce this path. String optional ""
version sycl toolkit version. Required for deliverable toolkit only. String optional ""

ENVIRONMENT VARIABLES

This repository rule depends on the following environment variables:

  • CMPLR_ROOT