# Question on unsafepointer load method

**URL:** <https://forum.modular.com/t/question-on-unsafepointer-load-method/2082>\
**Category:** Mojo\
**Created:** [August 6, 2025, 6:59am UTC](https://forum.modular.com/t/question-on-unsafepointer-load-method/2082 "2025-08-06T06:59:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonl2219](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@antonl2219](https://forum.modular.com/u/antonl2219)\
**Post date:** [August 6, 2025, 6:59am UTC](https://forum.modular.com/t/question-on-unsafepointer-load-method/2082/1 "2025-08-06T06:59:23Z")

</div>

Hello,

I’m looking at the documentation of the load method for the UnsafePointer, specifically at the second version that provides an offset as argument.

The offset type is SIMD[dtype,1]. I was expecting some sort of integer.

What do I miss?

> **[UnsafePointer | Modular](https://docs.modular.com/mojo/stdlib/memory/unsafe_pointer/UnsafePointer/)**
>
> UnsafePointer\[T\] represents an indirect reference to one or more values of type T consecutively in memory, and can refer to uninitialized memory.

---

<div class="post-metadata">

**Author:** ![duck\_tape](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/duck_tape/32/432_2.png) [@duck\_tape](https://forum.modular.com/u/duck_tape)\
**Post date:** [August 6, 2025, 2:21pm UTC](https://forum.modular.com/t/question-on-unsafepointer-load-method/2082/2 "2025-08-06T14:21:58Z")

</div>

`SIMD[dtype, 1]` is an integer and is equivalent to `Scalar[dtype]`, which is in turn equivalent to `{UInt32, Int64, Float64, UInt8, Int16...}`etc.

---

<div class="post-metadata">

**Author:** ![owenhilyard](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/owenhilyard/32/41_2.png) [@owenhilyard](https://forum.modular.com/u/owenhilyard)\
**Post date:** [August 6, 2025, 2:55pm UTC](https://forum.modular.com/t/question-on-unsafepointer-load-method/2082/3 "2025-08-06T14:55:04Z")

</div>

The first line of code in that function is `constrained[offset.dtype.is_integral(), “offset must be integer”]()`. We’re waiting on `restrict` to make that more ergonomic and clear.

---

<div class="post-metadata">

**Author:** ![antonl2219](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@antonl2219](https://forum.modular.com/u/antonl2219)\
**Post date:** [August 7, 2025, 2:26pm UTC](https://forum.modular.com/t/question-on-unsafepointer-load-method/2082/4 "2025-08-07T14:26:06Z")

</div>

Thanks for help.

In my case the cause of the compilation crash was the fact the I passed the with parameter with without the name. The compiler messages weren’t helpful.

Coming back to the documentation, as you might bellow the identifier dtype is used for the type parameter and it appears in the offset type as well. I would read that for loads of Float32 the offset is also a Float32, which does not make sense.

 ![image](https://us1.discourse-cdn.com/flex001/uploads/modular/original/1X/4740c5a71cf305246121bcd951e8a3374b03b89e.png)

---

<div class="post-metadata">

**Author:** ![arthur](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/arthur/32/139_2.png) [@arthur](https://forum.modular.com/u/arthur)\
**Post date:** [August 7, 2025, 6:15pm UTC](https://forum.modular.com/t/question-on-unsafepointer-load-method/2082/5 "2025-08-07T18:15:18Z")

</div>

Hmm. That seems like a bug in our doc generator. The actual signature for the `offset` is just `Scalar`. The `dtype` for this scalar should be inferred, and is separate from the infer-only `dtype` parameter in the signature (which relates to the type of the pointer and the type of the returned SIMD.

The doc generator is trying to fill in helpful information here, but in this case it ends up obfuscating rather than helping.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex001/uploads/modular/original/1X/2751e0fbdc595a99718b216730957e9db4448cfd.jpeg) [@system](https://forum.modular.com/u/system)\
**Post date:** [February 3, 2026, 6:15pm UTC](https://forum.modular.com/t/question-on-unsafepointer-load-method/2082/6 "2026-02-03T18:15:51Z")

</div>

Closed on February 3, 2026, 6:15pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
