Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core/simd]: Write package documentation #4545

Open
wants to merge 175 commits into
base: master
Choose a base branch
from

Conversation

flysand7
Copy link
Contributor

@flysand7 flysand7 commented Dec 1, 2024

No description provided.

flysand7 and others added 30 commits December 1, 2024 11:42
Do not memory map files; Windows cannot write to a file that is memory
mapped.
Write cache after llvm building. This ensures the cache won't have a
false positive if llvm fails.
This returns the number of runes in a u16 slice
Kelimion and others added 21 commits December 1, 2024 11:54
* Fix odin-lang#4508 for abs, min, max and the rest of the builtins.

None of these segfault now:
```odin
package bug

main :: proc() {
	p :: proc() {}

	// _ = len(p())
	// _ = cap(p())

	// _ = size_of(p())
	// _ = align_of(p())

	// T :: struct {}
	// _ = offset_of(p())
	// _ = offset_of(T, p())
	// _ = offset_of(p(), foo)
	// _ = offset_of(p(), "")

	// _ = type_of(p())
	// _ = type_info_of(p())
	// _ = typeid_of(p())

	// A: [4]int
	// _ = swizzle(p())    //  :: proc(x: [N]T, indices: ..int) -> [len(indices)]T ---
	// _ = swizzle(A, p()) //  :: proc(x: [N]T, indices: ..int) -> [len(indices)]T ---

	// _ = complex(p(), p())
	// _ = quaternion(p(), p(), p(), p())
	// _ = quaternion(w=p(), x=p(), y=p(), z=p())

	// _ = real(p())
	// _ = imag(p())
	// _ = jmag(p())
	// _ = kmag(p())
	// _ = conj(p())

	// _ = expand_values(p())

	// _ = min(p())
	// _ = max(p())
	// _ = abs(p())
	// _ = clamp(p(), p(), p())

	// _ = soa_zip(p())
	// _ = soa_unzip(p())
}
```
And also moved Windows file procs to `os_windows.odin`, in line with all the other platforms who didn't have a dedicated `file_<platform>.odin`
core/simd/simd.odin Outdated Show resolved Hide resolved
core/simd/simd.odin Outdated Show resolved Hide resolved
core/simd/simd.odin Show resolved Hide resolved
/*
Check if SIMD is emulated on a target platform.

This value is `true`, if the compile-time target has the hardware support for
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This value is `true`, if the compile-time target has the hardware support for
This value is `false`, if the compile-time target has the hardware support for


This value is `true`, if the compile-time target has the hardware support for
at 128-bit (or wider) SIMD. If the compile-time target lacks the hardware support
for 128-bit SIMD, this value is `false`, and all SIMD operations will be
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for 128-bit SIMD, this value is `false`, and all SIMD operations will be
for 128-bit SIMD, this value is `true`, and all SIMD operations will likely be

core/simd/simd.odin Outdated Show resolved Hide resolved
core/simd/simd.odin Outdated Show resolved Hide resolved
core/simd/simd.odin Outdated Show resolved Hide resolved
core/simd/simd.odin Outdated Show resolved Hide resolved
core/simd/simd.odin Outdated Show resolved Hide resolved
core/simd/simd.odin Show resolved Hide resolved
core/simd/simd.odin Show resolved Hide resolved
core/simd/simd.odin Show resolved Hide resolved
core/simd/simd.odin Show resolved Hide resolved
core/simd/simd.odin Show resolved Hide resolved
+-------+-------+-------+-------+
res:
+-------+-------+-------+--------+
| 0x44 | 0xaa | 0x06 | 0xfe |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay this one I have to refuse, I was assuming 1-byte lanes, which I should probably make explicit in the comments.

/*
Saturated addition of SIMD vectors.

The *saturated sum* is a sum, that upon overflow or underflow, instead of
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I should rewrite this.

core/simd/simd.odin Outdated Show resolved Hide resolved
res := simd.gather(ptrs, defaults, mask)
fmt.println(res)

The code would print `<2, 127, 10, 127>`. First and the third positions came
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are indented with a tab. Thanks for Output: tip!

core/simd/simd.odin Outdated Show resolved Hide resolved
+------+------+------+------+
| 0 | 1 | 0.33 | 0.2 |
+------+------+------+------+
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1/0 may not result in 0. That's a poor example.

@flysand7
Copy link
Contributor Author

flysand7 commented Jan 8, 2025

Did some fixes, I think this one's ready for the final review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.