[RFC] Dynamic Vector Support (#4200)

Introduce a new concept in the IR that allows a producer to create
dynamic vector types. An IR function can now contain global value(s)
that represent a dynamic scaling factor, for a given fixed-width
vector type. A dynamic type is then created by 'multiplying' the
corresponding global value with a fixed-width type. These new types
can be used just like the existing types and the type system has a
set of hard-coded dynamic types, such as I32X4XN, which the user
defined types map onto. The dynamic types are also used explicitly
to create dynamic stack slots, which have no set size like their
existing counterparts. New IR instructions are added to access these
new stack entities.

Currently, during codegen, the dynamic scaling factor has to be
lowered to a constant so the dynamic slots do eventually have a
compile-time known size, as do spill slots.

The current lowering for aarch64 just targets Neon, using a dynamic
scale of 1.

Copyright (c) 2022, Arm Limited.
This commit is contained in:
Sam Parker
2022-07-07 20:54:39 +01:00
committed by GitHub
parent 9ae060a12a
commit 9c43749dfe
69 changed files with 2422 additions and 294 deletions

View File

@@ -575,7 +575,7 @@ impl Mutator for RemoveUnusedEntities {
let mut stack_slots = StackSlots::new();
for (stack_slot, stack_slot_data) in func.stack_slots.clone().iter() {
for (stack_slot, stack_slot_data) in func.sized_stack_slots.clone().iter() {
if let Some(stack_slot_usage) = stack_slot_usage_map.get(&stack_slot) {
let new_stack_slot = stack_slots.push(stack_slot_data.clone());
for &inst in stack_slot_usage {
@@ -591,7 +591,7 @@ impl Mutator for RemoveUnusedEntities {
}
}
func.stack_slots = stack_slots;
func.sized_stack_slots = stack_slots;
"Remove unused stack slots"
}
@@ -617,9 +617,9 @@ impl Mutator for RemoveUnusedEntities {
// These can create cyclic references, which cause complications. Just skip
// the global value removal for now.
// FIXME Handle them in a better way.
GlobalValueData::Load { .. } | GlobalValueData::IAddImm { .. } => {
return None
}
GlobalValueData::Load { .. }
| GlobalValueData::IAddImm { .. }
| GlobalValueData::DynScaleTargetConst { .. } => return None,
}
}