style: clear the fmt gate and two lib clippy warnings
CI / Format Check (push) Canceled after 0s
Performance Benchmarks / Run Benchmarks (push) Canceled after 0s
CI / Clippy Check (push) Canceled after 0s
CI / Build (macos-latest) (push) Canceled after 0s
CI / Build (ubuntu-latest) (push) Canceled after 0s
CI / Test (macos-latest) (push) Canceled after 0s
CI / Test (ubuntu-latest) (push) Canceled after 0s
CI / Build CPU-Only (Explicit) (push) Canceled after 0s
CI / Python Bindings (maturin) (macos-latest) (push) Canceled after 0s
CI / Python Bindings (maturin) (ubuntu-latest) (push) Canceled after 0s
CI / WASM Build + Size Check (push) Canceled after 0s
CI / Distributed Training Tests (push) Canceled after 0s
CI / CI Success (push) Canceled after 0s
Documentation / Build API Documentation (push) Canceled after 0s
Documentation / Build User Guide (push) Canceled after 0s

Deferred deliberately while the TWIN-2B/2C campaign had live marches:
each march is a fresh `cargo test` invocation, so reformatting
`turek_hron_fsi2.rs` mid-campaign would have forced a test-binary
rebuild and cost comparability for a cosmetic gate. The family closed,
so this is now free.

- `cargo fmt --all` across 8 files that had drifted (including the
  FSI2/FSI3 harnesses touched by the UMEAN/ES override commits).
- `rtx-feature-store/tests/integration_tests.rs` had trailing
  whitespace rustfmt refused to format around ("left behind trailing
  whitespace" internal error), so the whole file was being skipped;
  stripped it and the file formats now.
- Two `unnecessary_parentheses` warnings in the rtx-transformers lib
  (`continual/progressive.rs`, `curriculum/mod.rs`) — these were the
  only rustytorch warnings surfacing through omni-cortex's workspace
  clippy gate, which is how they were found.

No behaviour change. rtx-fsi test binaries still build.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01B1feFAQxjbCRHePUdxuNra
This commit is contained in:
Omar Sobh
2026-09-02 19:15:53 -07:00
co-authored by Claude Opus 5
parent 045e145962
commit 9575b84803
11 changed files with 44 additions and 35 deletions
@@ -37,11 +37,7 @@ pub fn conv2d(
// groups 1. Dispatch to it when possible.
#[cfg(target_os = "macos")]
{
if stride[0] == stride[1]
&& padding[0] == padding[1]
&& dilation == [1, 1]
&& groups == 1
{
if stride[0] == stride[1] && padding[0] == padding[1] && dilation == [1, 1] && groups == 1 {
let mut output = MetalBuffer::new(device, out_numel, MetalBufferUsage::Shared)
.expect("Failed to allocate output buffer for conv2d");
nn::conv2d(
+4 -13
View File
@@ -16,7 +16,7 @@ use crate::MetalTensorPrimitive;
use rtx_metal::{MetalBuffer, MetalBufferUsage};
#[cfg(target_os = "macos")]
use rtx_metal::sparse::{spmm_csr, CsrMatrix};
use rtx_metal::sparse::{CsrMatrix, spmm_csr};
#[cfg(target_os = "macos")]
use std::cell::RefCell;
@@ -69,8 +69,7 @@ fn cached_select_csr(
let row_ptr: Vec<i32> = (0..=e as i32).collect();
let col_indices: Vec<i32> = indices.iter().map(|&i| i as i32).collect();
let values = vec![1.0f32; e];
let csr =
CsrMatrix::new(device, e, num_src_rows, &row_ptr, &col_indices, &values).ok()?;
let csr = CsrMatrix::new(device, e, num_src_rows, &row_ptr, &col_indices, &values).ok()?;
let csr = Rc::new(csr);
if cache.len() >= CSR_CACHE_CAP {
cache.clear();
@@ -203,11 +202,7 @@ pub fn index_select<const D: usize>(
MetalBuffer::new(device, out_numel, MetalBufferUsage::Shared)
{
if spmm_csr(device, &csr, tensor.data(), &mut output, row_len).is_ok() {
return MetalTensorPrimitive::new(
output,
out_shape,
tensor.device.clone(),
);
return MetalTensorPrimitive::new(output, out_shape, tensor.device.clone());
}
}
}
@@ -267,11 +262,7 @@ pub fn index_add<const D: usize>(
MetalBuffer::new(device, out_numel, MetalBufferUsage::Shared)
{
if spmm_csr(device, &csr, tensor.data(), &mut output, row_len).is_ok() {
return MetalTensorPrimitive::new(
output,
out_shape,
tensor.device.clone(),
);
return MetalTensorPrimitive::new(output, out_shape, tensor.device.clone());
}
}
}
+13 -4
View File
@@ -171,8 +171,11 @@ pub fn pow<const D: usize>(tensor: &MetalTensorPrimitive<D>, exp: f32) -> MetalT
///
/// rtx-metal has no dedicated kernel for this op; computed on host
/// (same fallback pattern as `reduction::sum_dim`).
pub fn clamp<const D: usize>(tensor: &MetalTensorPrimitive<D>, min: f32,
max: f32) -> MetalTensorPrimitive<D> {
pub fn clamp<const D: usize>(
tensor: &MetalTensorPrimitive<D>,
min: f32,
max: f32,
) -> MetalTensorPrimitive<D> {
let device = tensor.device.metal_device();
let data = tensor.to_vec();
let result: Vec<f32> = data.iter().map(|x| x.clamp(min, max)).collect();
@@ -184,10 +187,16 @@ pub fn clamp<const D: usize>(tensor: &MetalTensorPrimitive<D>, min: f32,
///
/// rtx-metal has no dedicated kernel for this op; computed on host
/// (same fallback pattern as `reduction::sum_dim`).
pub fn gt_scalar<const D: usize>(tensor: &MetalTensorPrimitive<D>, value: f32) -> MetalTensorPrimitive<D> {
pub fn gt_scalar<const D: usize>(
tensor: &MetalTensorPrimitive<D>,
value: f32,
) -> MetalTensorPrimitive<D> {
let device = tensor.device.metal_device();
let data = tensor.to_vec();
let result: Vec<f32> = data.iter().map(|&x| if x > value { 1.0 } else { 0.0 }).collect();
let result: Vec<f32> = data
.iter()
.map(|&x| if x > value { 1.0 } else { 0.0 })
.collect();
let output = MetalBuffer::from_slice(device, &result).expect("Failed to create buffer");
MetalTensorPrimitive::new(output, tensor.shape, tensor.device.clone())
}