array memset testing
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Rust
- Sterne
- 3.4k
- Forks
- 126
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
UPDATED: I tried a few mutations in PR which do not trigger any CI failures on my personal fork: https://github.com/brody2consult/rust-gpu/pull/2
diff --git a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs
index d86db1cbd0..c2143f4436 100644
--- a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs
+++ b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs
@@ -290,22 +290,15 @@ macro_rules! simple_uni_op {
}
fn memset_fill_u16(b: u8) -> u16 {
- b as u16 | ((b as u16) << 8)
+ 0xbad_u16 | ((b as u16) << 10)
}
fn memset_fill_u32(b: u8) -> u32 {
- b as u32 | ((b as u32) << 8) | ((b as u32) << 16) | ((b as u32) << 24)
+ 0xbad_u32 | ((b as u32) << 20)
}
fn memset_fill_u64(b: u8) -> u64 {
- b as u64
- | ((b as u64) << 8)
- | ((b as u64) << 16)
- | ((b as u64) << 24)
- | ((b as u64) << 32)
- | ((b as u64) << 40)
- | ((b as u64) << 48)
- | ((b as u64) << 56)
+ 0xbad_u64 | ((b as u64) << 30)
}
fn memset_dynamic_scalar(
@@ -384,9 +377,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
32 => self
.constant_u32(self.span(), memset_fill_u32(fill_byte))
.def(self),
- 64 => self
- .constant_u64(self.span(), memset_fill_u64(fill_byte))
- .def(self),
_ => self.fatal(format!(
"memset on integer width {width} not implemented yet"
)),
@@ -2911,7 +2901,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
};
let elem_ty_spv = self.lookup_type(elem_ty);
let pat = match self.builder.lookup_const_scalar(fill_byte) {
- Some(fill_byte) => self.memset_const_pattern(&elem_ty_spv, fill_byte as u8),
+ Some(_) => self.memset_const_pattern(&elem_ty_spv, 123),
None => self.memset_dynamic_pattern(&elem_ty_spv, fill_byte.def(self)),
}
.with_type(elem_ty);
and some more that do not trigger any compiletest failures or difftest failures in my personal workarea:
diff --git a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs
index d86db1cbd0..b6a867933f 100644
--- a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs
+++ b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs
@@ -290,21 +290,16 @@ macro_rules! simple_uni_op {
}
fn memset_fill_u16(b: u8) -> u16 {
- b as u16 | ((b as u16) << 8)
+ b as u16
}
fn memset_fill_u32(b: u8) -> u32 {
- b as u32 | ((b as u32) << 8) | ((b as u32) << 16) | ((b as u32) << 24)
+ b as u32
}
fn memset_fill_u64(b: u8) -> u64 {
b as u64
| ((b as u64) << 8)
- | ((b as u64) << 16)
- | ((b as u64) << 24)
- | ((b as u64) << 32)
- | ((b as u64) << 40)
- | ((b as u64) << 48)
| ((b as u64) << 56)
}
I discovered this while investigating possible testing for a more general solution to #594.
I suspect the test cases from PR #586 may be able to help avoid this issue if we can adapt these to test memset array fill for u64, i64, u32, etc & check the disassembly. This could give me some more confidence in case we would ever want to refactor some of this memset-related code (someday).
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in crates/rustc_codegen_spirv/src/builder/builder_methods.rs und überprüfe die memset-Hilfsfunktionen und die Pfade zum Füllen von Arrays. Passe die Testfälle aus PR #586 an, um das Füllen von Arrays mittels memset für u64, i64 und u32 abzudecken, und überprüfe anschließend die erzeugte Disassemblierung. Als abgeschlossen gilt die Arbeit, wenn die Tests die im Issue beschriebenen Mutationen erkennen, ohne Lücken bei compiletest oder difftest.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- compilers, testing-qa
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100