Skip to main content
Glama

test_kernel

Test one kernel without writing a program: supply its source, launch config, arguments and expected outputs, and it compiles, runs and reports the elements that differ.

Instructions

Test one kernel without writing a program: give its source, the launch configuration, its arguments (scalars, and arrays with their data, given or generated), and the expected outputs, as values or as a host reference function. A generated program launches the kernel, compares each output (exactly for integers, within a tolerance for floating point) and reports the elements that differ. With check (the default), it also runs in the thread orders and with the sanitizers that check uses.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "kernel": "<kernel>",
      "name": "<name>",
      "grid": "<grid>",
      "block": "<block>",
      "arguments": "<arguments>"
    },
    "name": "test_kernel"
  }
}

Input Schema

NameRequiredDescriptionDefault
gridYesBlocks: a number or [x, y, z]
nameYesThe kernel to launch (a template with its arguments, e.g. scale<float>, works too)
blockYesThreads per block: a number or [x, y, z]
checkNoAlso run in other thread orders and with the sanitizers (default true)
seedsNoAs check's
kernelYesThe source of the kernel, with what it needs (device functions, includes, constants)
optionsNoCompiler options, as nvcc's (-arch, -Xcompiler, -std, -I, -D, ...) or hipcc's; GPU options are accepted and ignored. Default -O2 -g.
languageNocuda (cuda4cpu-nvcc, the default) or hip (cuda4cpu-hipcc, the default when a source is a .hip file)
argumentsYesThe kernel's arguments, in order
referenceNoC++ host code that defines void reference(...) with the kernel's parameters: it gets host copies of the inputs and writes the expected outputs into the output arrays (those without expected values)
toleranceNoFor floating-point outputs: an element matches if |got - expected| <= absolute + relative * |expected| (default 1e-5 and 1e-5)
shared_bytesNoDynamic shared memory per block (default 0)
timeout_secondsNoTime limit for each run (default 60, at most 600)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.0

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does substantial work: it discloses that a program is generated, that comparison is exact for integers and tolerance-based for floats, that differing elements are reported, and that `check` additionally exercises thread orders and sanitizers. It does not disclose the failure/result shape in detail, permissions, or the 60s default/600s cap (which live only in the schema).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three dense sentences, front-loaded with the core action and followed by comparison and check behavior. The first sentence is long and clause-heavy, but essentially every clause carries information; there is no filler or marketing language.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter, nested-object tool with no annotations and no output schema, the description covers the main workflow well but leaves the return shape vague ('reports the elements that differ') and does not explain `seeds` beyond 'As check's', which depends on the agent knowing a sibling. Timeout, shared_bytes, and language defaults are left entirely to the schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already defines every parameter including generators, tolerance, check, and options. The description adds the conceptual model (arguments in order, expected as values or a host reference function) but little syntax-level meaning beyond what the schema states; this is the expected baseline when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb and resource ('Test one kernel') and immediately scopes what is supplied and what happens ('A generated program launches the kernel, compares each output'). It implicitly separates this from the compile/run siblings by saying 'without writing a program' and by naming how `check` behaves, though it never names a sibling as an explicit alternative.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The use case is clear: you have a kernel source plus expected outputs and want to validate it without authoring a harness. The default of `check` is stated so the agent knows the baseline behavior. There is no explicit when-not guidance (e.g., when to prefer `run` or `compile` instead) and no mention of prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools