Skip to content

Conversation

@andrewstanfordjason
Copy link

This PR adds the initial code for VX4B and a makefile to actually make it. It also updated relevant tests to relax requirements when necessary

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds initial VX4B architecture support to the xcore_math library, including new assembly implementations, build system updates, and platform-specific adjustments.

Changes:

  • Adds VX4B assembly implementations for vector operations across multiple data types (s8, s16, s32, f32, complex types)
  • Updates build system to support VX4B architecture alongside existing XS3A platform
  • Modifies saturation bounds and scalar operations to handle VX4B architectural differences

Reviewed changes

Copilot reviewed 152 out of 197 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
lib_xcore_math/src/arch/vx4b/vect_sXX/vect_sXX_add_scalar.S Implements scalar addition for VX4B vector operations
lib_xcore_math/src/arch/vx4b/vect_s8/vect_s8_is_negative.S Implements negative value detection for 8-bit vectors
lib_xcore_math/src/arch/vx4b/vect_s32/*.S Multiple 32-bit vector operations (unzip, to_s16, to_f32, sum, scale, etc.)
lib_xcore_math/src/arch/vx4b/vect_s16/*.S Multiple 16-bit vector operations (sum, scale, mul, inverse, energy, abs)
lib_xcore_math/src/arch/vx4b/vect_f32/*.S Floating-point vector operations (to_s32, max_exponent, add, complex operations)
lib_xcore_math/src/arch/vx4b/vect_complex_s32/*.S Complex 32-bit operations (to_s16, squared_mag, mul, conjugate, macc/nmacc variants)
lib_xcore_math/src/arch/vx4b/scalar/*.S Scalar operations (sqrt, radians conversion, power series, logistic, norm, log2)
lib_xcore_math/src/arch/vx4b/misc/*.S Utility functions (memcpy, vector copy, util functions)
lib_xcore_math/src/arch/vx4b/filter/*.S FIR filter implementation
lib_xcore_math/src/arch/vx4b/fft/*.S FFT operations (tail reverse, index bit reversal, HR lookup table)
lib_xcore_math/src/arch/vx4b/dct/*.S DCT operations (flip, scale, convolve, adsb, forward/inverse transforms)
lib_xcore_math/src/arch/vx4b/chunk_s32/*.S Chunk operations for 32-bit data (power series, dot product)
lib_xcore_math/src/arch/vx4b/chunk_s16/*.c Chunk accumulate implementation for 16-bit data
lib_xcore_math/src/arch/ref/vpu_scalar_ops.c Updates scalar operations for VX4B architecture differences
lib_xcore_math/api/xmath/xs3/vpu_info.h Updates saturation bounds to support VX4B MIN values
lib_xcore_math/api/xmath/xs3/vpu_scalar_ops.h Adds VX4B-specific function signatures
lib_xcore_math/api/xmath/util.h Adds VX4B support to cls inline function
lib_xcore_math/CMakeLists.txt Updates build system to include VX4B assembly files and link libm
examples/*/CMakeLists.txt Removes redundant -lm flags from example applications

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,69 @@
// Copyright 2021-2022 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
// XMOS Public License: Version 1
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

Inconsistent license format. Uses 'XMOS Public License' instead of 'XMOS Public Licence' (with 'c') as used in other files.

Suggested change
// XMOS Public License: Version 1
// XMOS Public Licence: Version 1

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,114 @@
// Copyright 2021-2022 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
// XMOS Public License: Version 1
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

Inconsistent license format. Uses 'XMOS Public License' instead of 'XMOS Public Licence' (with 'c') as used in other files.

Suggested change
// XMOS Public License: Version 1
// XMOS Public Licence: Version 1

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,119 @@
// Copyright 2020-2023 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
// XMOS Public License: Version 1
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

Inconsistent license format. Uses 'XMOS Public License' instead of 'XMOS Public Licence' (with 'c') as used in other files.

Suggested change
// XMOS Public License: Version 1
// XMOS Public Licence: Version 1

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,119 @@
// Copyright 2020-2023 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
// XMOS Public License: Version 1
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

Inconsistent license format. Uses 'XMOS Public License' instead of 'XMOS Public Licence' (with 'c') as used in other files.

Suggested change
// XMOS Public License: Version 1
// XMOS Public Licence: Version 1

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,128 @@
// Copyright 2020-2023 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
// XMOS Public License: Version 1
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

Inconsistent license format. Uses 'XMOS Public License' instead of 'XMOS Public Licence' (with 'c') as used in other files.

Suggested change
// XMOS Public License: Version 1
// XMOS Public Licence: Version 1

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,129 @@
// Copyright 2020-2023 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
// XMOS Public License: Version 1
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

Inconsistent license format. Uses 'XMOS Public License' instead of 'XMOS Public Licence' (with 'c') as used in other files.

Suggested change
// XMOS Public License: Version 1
// XMOS Public Licence: Version 1

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,129 @@
// Copyright 2020-2023 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
// XMOS Public License: Version 1
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

Inconsistent license format. Uses 'XMOS Public License' instead of 'XMOS Public Licence' (with 'c') as used in other files.

Suggested change
// XMOS Public License: Version 1
// XMOS Public Licence: Version 1

Copilot uses AI. Check for mistakes.
#endif
{
vpu_int16_acc_t s = acc;
int64_t s = acc;
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

Type change from vpu_int16_acc_t to int64_t may cause issues if vpu_int16_acc_t is not equivalent to int64_t. Consider documenting why this change is necessary for VX4B support.

Suggested change
int64_t s = acc;
/* Use a 64-bit accumulator for intermediate operations so that VX4B's
* negative right_shift_t values (implemented as left shifts) cannot
* overflow the underlying vpu_int16_acc_t representation. This keeps the
* public accumulator type unchanged while guaranteeing at least 64-bit
* precision for all internal shift/rounding steps. */
int64_t s = (int64_t) acc;

Copilot uses AI. Check for mistakes.
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.

3 participants