Skip to content

Commit b7383a4

Browse files
authored
Merge branch 'main' into cleanup
2 parents c38c18c + be72d5c commit b7383a4

7 files changed

Lines changed: 59 additions & 30 deletions

File tree

.github/workflows/pr.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,27 @@ jobs:
5454
run: |
5555
source "${HOME}/.cargo/env"
5656
cargo build
57+
58+
- name: Format check
59+
env:
60+
CUDA_TOOLKIT_PATH: /usr/local/cuda-13
61+
CUDA_TILE_USE_LLVM_INSTALL_DIR: /usr/lib/llvm-21
62+
run: |
63+
source "${HOME}/.cargo/env"
64+
cargo fmt -- --check
65+
66+
- name: Clippy
67+
env:
68+
CUDA_TOOLKIT_PATH: /usr/local/cuda-13
69+
CUDA_TILE_USE_LLVM_INSTALL_DIR: /usr/lib/llvm-21
70+
run: |
71+
source "${HOME}/.cargo/env"
72+
cargo clippy
73+
74+
- name: Test (compile only)
75+
env:
76+
CUDA_TOOLKIT_PATH: /usr/local/cuda-13
77+
CUDA_TILE_USE_LLVM_INSTALL_DIR: /usr/lib/llvm-21
78+
run: |
79+
source "${HOME}/.cargo/env"
80+
cargo test --no-run

cuda-tile-rs/examples/build_translate_basic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
*/
55

66
use cuda_tile_rs::util::{operation_parse, parse_named_attr};
7-
use melior::Context;
87
use melior::dialect::DialectRegistry;
98
use melior::ir::attribute::{StringAttribute, TypeAttribute};
109
use melior::ir::r#type::FunctionType;
1110
use melior::ir::{
1211
Attribute, Block, BlockLike, Identifier, Location, Region, RegionLike, Type, Value, ValueLike,
1312
};
1413
use melior::utility::{register_all_dialects, register_all_llvm_translations};
14+
use melior::Context;
1515
use std::error::Error;
1616
use std::process::Command;
1717

cuda-tile-rs/src/cuda_tile_c_bindings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ unsafe extern "C" {
201201
unsafe extern "C" {
202202
#[doc = " Returns a cuda_tile RoundingModeAttr with the given rounding mode string."]
203203
pub fn mlirCudaTileRoundingModeAttrGet(ctx: MlirContext, value: MlirStringRef)
204-
-> MlirAttribute;
204+
-> MlirAttribute;
205205
}
206206
unsafe extern "C" {
207207
#[doc = " Returns the rounding mode string of the given cuda_tile RoundingModeAttr."]
@@ -287,7 +287,7 @@ unsafe extern "C" {
287287
unsafe extern "C" {
288288
#[doc = " Returns a cuda_tile PaddingValueAttr with the given padding value string."]
289289
pub fn mlirCudaTilePaddingValueAttrGet(ctx: MlirContext, value: MlirStringRef)
290-
-> MlirAttribute;
290+
-> MlirAttribute;
291291
}
292292
unsafe extern "C" {
293293
#[doc = " Returns the padding value string of the given cuda_tile PaddingValueAttr."]

cuda-tile-rs/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ mod tests {
8080

8181
use crate::cuda_tile::{self};
8282
use crate::util::{attribute_parse, operation_parse, type_parse};
83-
use melior::Context;
8483
use melior::dialect::DialectRegistry;
85-
use melior::ir::RegionLike;
8684
use melior::ir::attribute::StringAttribute;
8785
use melior::ir::operation::{OperationBuilder, OperationLike};
86+
use melior::ir::RegionLike;
8887
use melior::ir::{Attribute, Block, Identifier, Location, Module, Region};
8988
use melior::utility::{register_all_dialects, register_all_llvm_translations};
89+
use melior::Context;
9090

9191
static TEST_MUTEX: Mutex<()> = Mutex::new(());
9292
static REGISTER_GLOBALS: Once = Once::new();

cuda-tile-rs/src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*/
55

66
use melior::{
7-
Context, StringRef,
8-
ir::{Attribute, Identifier, Operation, Type, operation::OperationLike},
7+
ir::{operation::OperationLike, Attribute, Identifier, Operation, Type},
98
pass::PassManager,
9+
Context, StringRef,
1010
};
1111
use mlir_sys::mlirPassManagerRunOnOp;
1212
use mlir_sys::{mlirAttributeParseGet, mlirOperationCreateParse};

cutile-macro/src/kernel_launcher_generator.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,12 @@ pub fn infer_shape_params_from_tensor_type(
10291029
// This might make sense for a small tensor.
10301030
required_generics.expressions.insert(last_ident.clone(), Some(format!("{var_name}.shape.iter().map(|x| x.to_string()).collect::<Vec<String>>()")));
10311031
}
1032+
SupportedGenericType::ConstScalar => {
1033+
return type_path.err(
1034+
"Unexpected constant scalar type in tensor generic argument.",
1035+
);
1036+
}
1037+
SupportedGenericType::Unknown => {}
10321038
}
10331039
SupportedGenericType::ConstScalar => {
10341040
return type_path
@@ -1087,6 +1093,7 @@ pub fn infer_shape_params_from_tensor_type(
10871093
)),
10881094
);
10891095
}
1096+
SupportedGenericType::Unknown => {}
10901097
}
10911098
SupportedGenericType::Unknown => {}
10921099
}

cutile-macro/src/types.rs

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,34 +1146,32 @@ impl Iterator for ConstGenericArrayTypeListIterator {
11461146
}
11471147
}
11481148
Some(Ok(self.state.clone()))
1149+
} else if self.done {
1150+
None
11491151
} else {
1150-
if self.done {
1151-
None
1152-
} else {
1153-
for _i in 0..self.iterators.len() {
1154-
// Traverse in reverse to remain consistent with traversal order of individual ConstGenericArrayIterator.
1155-
// The traversal is a mixed-radix counter.
1156-
// We're done when the most significant position is None.
1157-
let i = (self.iterators.len() - 1) - _i;
1158-
let iter = &mut self.iterators[i];
1159-
let item: Option<ConstGenericArrayType> = iter.next();
1160-
match item {
1161-
Some(item) => {
1162-
self.state[i] = item;
1163-
break;
1164-
}
1165-
None => {
1166-
if i == 0 {
1167-
self.done = true;
1168-
return None;
1169-
}
1170-
self.iterators[i] = iter.renew();
1171-
self.state[i] = self.iterators[i].next().unwrap();
1152+
for _i in 0..self.iterators.len() {
1153+
// Traverse in reverse to remain consistent with traversal order of individual ConstGenericArrayIterator.
1154+
// The traversal is a mixed-radix counter.
1155+
// We're done when the most significant position is None.
1156+
let i = (self.iterators.len() - 1) - _i;
1157+
let iter = &mut self.iterators[i];
1158+
let item: Option<ConstGenericArrayType> = iter.next();
1159+
match item {
1160+
Some(item) => {
1161+
self.state[i] = item;
1162+
break;
1163+
}
1164+
None => {
1165+
if i == 0 {
1166+
self.done = true;
1167+
return None;
11721168
}
1169+
self.iterators[i] = iter.renew();
1170+
self.state[i] = self.iterators[i].next().unwrap();
11731171
}
11741172
}
1175-
Some(Ok(self.state.clone()))
11761173
}
1174+
Some(Ok(self.state.clone()))
11771175
}
11781176
}
11791177
}

0 commit comments

Comments
 (0)