Skip to content

cmd/compile: bounds-check elimination for archsimd loop reading 2 buffers per iteration #79811

Description

@balasanjay

Go version

go tip

Output of go env in your module/workspace:

<redacted>

What did you do?

I wrote* some archsimd code over lunch to measure the performance of some simple loops.

I wrote some code to count the number of uppercase ASCII letters in a buffer.

I wrote a scalar and AVX2 version. Both of them had their bounds checks eliminated entirely (yay!).

I than wrote a 4x unrolled versions of the scalar and AVX2 loops (as well as a 2x unrolled variants), to avoid a loop-carried dependency on the "count" variable.

(* full disclosure: I was using this to test out a new AI coding agent, but I personally reviewed all generated code)

What did you see happen?

It looks like the 4x unrolled versions did not have bounds-checks eliminated.

What did you expect to see?

I expected bounds-check eliminations to still work, even with the 4x unrolled variants.

Especially because my overall program harness had AVX2 variant reading 32 bytes at a time, with bounds checks eliminated, and a 2xAVX variant (also reading 32 bytes per loop iteration, split over 2 registers/counters). The latter did not have bounds checks eliminated, as far as I can tell.

Metadata

Metadata

Assignees

Labels

FixPendingIssues that have a fix which has not yet been reviewed or submitted.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions