Skip to main content
The CSL compiler is invoked with the command cslc on your terminal. See Working With Code Samples for usage examples.

Synopsis

cslc <csl_filename> [-o OUTPUT_NAME] [--arch=ARCH]
     [--fabric-dims=W,H] [--fabric-offsets=X,Y]
     [--params NAME:VALUE[,...]] [--colors NAME:VALUE[,...]]
     [--memcpy] [--channels N]
     [--fp16-format=FORMAT]
     [--import-path DIR]
     [--width-west-buf N] [--width-east-buf N]
     [--output-json[=PATH]] [--out-routes]
     [--max-inlined-iterations N] [--comptime-func-depth-limit N]
     [--max-parallelism N] [-g0]
     [--warnings-as-errors] [--verbose] [-h]
<csl_filename> is the top-level CSL source file (typically layout.csl).

Output

-o OUTPUT_NAME

Output directory name. ELF files and other build artifacts are written under this directory. Default: out.

--output-json[=PATH]

Write a JSON file containing the resolved compilation parameters. If PATH is omitted, the file is named based on -o with a .json extension. This is the file host code typically reads to recover --params values at run time.

--out-routes

Print an ASCII table of per-PE color and routing information during compilation. Useful for debugging routes.

Target architecture and fabric

--arch=ARCH

Select the target architecture. Valid values: wse2, wse3. Default: wse2. The architecture you compile for must match the system you intend to run on.

--fabric-dims=W,H

Width and height of the target fabric in PE units. For simulator runs, any bounding box large enough to contain your program rectangle suffices; for hardware, these must match the actual fabric dimensions of your CS system.

--fabric-offsets=X,Y

Offset of the upper-left corner of your program rectangle within the fabric. Together with --fabric-dims, this defines where the program lives on the fabric.

--fp16-format=FORMAT

Choose which 16-bit floating-point format may be used at runtime. Valid values:
  • f16 — IEEE half precision (5-bit exponent, 10-bit mantissa). The default.
  • cb16 — Cerebras float16 (6-bit exponent, 9-bit mantissa, customized bias).
  • bf16 — Brain float16 (8-bit exponent, 7-bit mantissa).
Values of the other two FP16 types must be comptime-known. See FP16 Types.

Compile-time parameters and colors

--params NAME:VALUE[,...]

Set the values of CSL source param declarations. The argument is a comma-separated list of name:value pairs where name matches a param in the source and value is an unsigned integer. May be specified multiple times; all values are concatenated.

--colors NAME:VALUE[,...]

Set the values of CSL source color declarations. Same format as --params. May be specified multiple times.

Memcpy

--memcpy

Add memcpy infrastructure to the program, enabling host-device data transfer and host-side function launches via SdkRuntime. Almost all SDK programs use this.

--channels N

Number of memcpy I/O channels. Required when --memcpy is used; the value must be at least 1 and no larger than the height of the program rectangle (maximum 16). Higher values increase host-device throughput; performance improvements are typically minimal past 8.

Module imports

--import-path DIR

Add DIR to the list of directories searched for <...> paths in @import_module and @set_tile_code statements. May be specified multiple times; directories are searched in command-line order, before the compiler’s built-in library directory.

Fabric I/O buffering

--width-west-buf N

Width of the west buffer. Default: 0 (no buffer). Increase to mitigate slow input from the west edge of the fabric.

--width-east-buf N

Width of the east buffer. Default: 0 (no buffer). Increase to mitigate slow output to the east edge of the fabric.

Compile-time limits

--max-inlined-iterations N

Maximum number of iterations allowed when the compiler unrolls inline loops. If exceeded, compilation fails. Default: 0, interpreted as no limit. Set this if a comptime loop is expanding more than you expect.

--comptime-func-depth-limit N

Maximum depth of the comptime function-call stack. If exceeded, compilation fails. Default: 0, interpreted as no limit. Set this if a recursive comptime function is exploring an unbounded space.

--max-parallelism N

Limit the compiler’s internal parallelism to N workers. Default: 0, interpreted as no limit. Lower this on shared build machines.

Debug and diagnostics

-g0

Disable DWARF debug-information generation. Without this option, the compiler always emits debug info in ELF files.

--warnings-as-errors

Treat all compiler warnings as errors.

--verbose

Verbose output. Prints information about each compiler phase and additional diagnostics if linking fails.

-h, --help

Print usage information and exit.