E6029

E6029 — A pointer argument into one memory passed to a parameter that wants a pointer into another: a host *mut f32 where *mut f32 in Memory::GPU_HBM is declared, or the reverse. The two are different types, and the C library or kernel behind the parameter reads the memory the declaration names, so the spaces must match exactly.

What the compiler reports

E6029
argument 1 of 'reads_host' is a pointer into Memory::GPU_HBM, but the parameter wants a pointer into host memory

The fragments the test suite holds the compiler to. An ellipsis marks text the test does not constrain; the emitted message also carries a source location.

A program that triggers it

//
// Part of the Vx Project, under the Apache License v2.0 with LLVM Exceptions.
// See LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// `as_ptr()` on a tensor in GPU memory gives a pointer into GPU memory, and that
// is not a host pointer. Passing it where a plain `*const f32` is expected is
// refused, and the message names both memories.

fn reads_host(p : *const f32) -> i32 {
  return 0;
}

fn main() -> i32 {
  let host_data : Tensor<f32, [4, 4]> = Tensor<f32, [4, 4]>::new();
  let on_gpu = transfer(host_data, Memory::GPU_HBM);
  let dp = on_gpu.as_ptr();
  return reads_host(dp);
}

From tests/frontend/fail/device_pointer_is_not_a_host_pointer.vx, which asserts this diagnostic on every commit.

Related