platforms icon indicating copy to clipboard operation
platforms copied to clipboard

[discussion] Deprecate `//cpu:armv8-m` in favor of `//cpu:armv8-m.main`

Open armandomontanez opened this issue 1 year ago • 3 comments

Similar to #100, I'm looking to tidy up some pre-existing Cortex-M CPU expressions here.

Proposal

Mark //cpu:armv8-m as deprecated, and introduce //cpu:armv8-m.base and //cpu:armv8-m.main.

Why?

ARMv8-M is technically split into two distinctly different ISAs: armv8-m.main and armv8-m.base. The baseline variant of ARMv8-M is more akin to ARMv6-M than ARMv7E-M. Also, when spelling -march, there is no such option for armv8-m. The flavors are either armv8-m.base or armv8-m.main. Note that these flavors are not traditionally considered extensions (unlike FPU or DSP instructions).

Also, this naming carries forward with the armv8.1-m.main architecture, even though it doesn't have a armv8.1-m.base variant.

armandomontanez avatar Sep 20 '24 18:09 armandomontanez

Perhaps there's an argument to be made that we should just jump ship entirely on this expression, and use the names available for -mcpu. They're more granular, and better express exactly what you're targeting. You can infer the -march names from -mcpu but not the other way around.

armandomontanez avatar Sep 20 '24 18:09 armandomontanez

It looks like @aiuto already clarified that we should be using the CPU type itself (rather than ISA) moving forward: https://github.com/bazelbuild/platforms/commit/0f056b51eeae683a144b2d1fc64a10819212172d

For now, I think the answer is to pivot to adding:

  • @platforms//cpu:cortex-m3
  • @platforms//cpu:cortex-m1
  • @platforms//cpu:cortex-m0
  • @platforms//cpu:cortex-m4
  • @platforms//cpu:cortex-m0plus
  • @platforms//cpu:cortex-m7
  • @platforms//cpu:cortex-m23
  • @platforms//cpu:cortex-m33
  • @platforms//cpu:cortex-m35p
  • @platforms//cpu:cortex-m55
  • @platforms//cpu:cortex-m85
  • @platforms//cpu:cortex-m52

And then mark the armv*-m ones as deprecated.

Note that for reasons being discussed in #100, no FPU nuances will be represented in these CPU types.

armandomontanez avatar Dec 14 '24 01:12 armandomontanez

I'm debating the value of converting the old variants to alias rules. Some translate trivially: armv7-m->cortex-m3, others less so: armv7e-m->[cortex-m4 or cortex-m7]. Also armv8-m should probably map to Cortex-M33 since M33 is likely what users want when they reference ARMv8-M (since main and base qualifiers were missing). Aliases seem like the right solution if there's ever a desire to eventually remove the old constraints, because otherwise migration is particularly difficult.

If we do aliases, we should probably map it like this:

  • armv6-m -> cortex-m0
  • armv7-m -> cortex-m3
  • armv7e-m -> cortex-m4
  • armv7e-mf -> considered completely deprecated.
  • armv8-m -> cortex-m33

armandomontanez avatar Dec 16 '24 17:12 armandomontanez