This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Implement ifunc selector
Needs ReviewPublic

Authored by BeMg on Jul 21 2023, 3:40 AM.

Details

Summary

Here is proposal https://github.com/riscv-non-isa/riscv-c-api-doc/pull/48.

During the Function multi-version dispatch the function, we need a method to retrieve the RISC-V hardware environment to make sure all extension must be available.

Diff Detail

Event Timeline

BeMg created this revision.Jul 21 2023, 3:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 3:40 AM
BeMg requested review of this revision.Jul 21 2023, 3:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 3:40 AM
Herald added subscribers: Restricted Project, wangpc, eopXD. · View Herald Transcript
BeMg retitled this revision from [RISCV] Implement ifunc selector to [WIP][RISCV] Implement ifunc selector.Jul 21 2023, 3:52 AM
jrtc27 requested changes to this revision.Jul 21 2023, 4:35 AM

This series is all highly Linux-specific and needs gating accordingly

This revision now requires changes to proceed.Jul 21 2023, 4:35 AM
BeMg updated this revision to Diff 544600.Jul 26 2023, 10:01 PM

Guard with linux

BeMg retitled this revision from [WIP][RISCV] Implement ifunc selector to [RISCV] Implement ifunc selector.Jul 26 2023, 10:02 PM
BeMg edited the summary of this revision. (Show Details)
BeMg added reviewers: kito-cheng, craig.topper, asb, reames.
craig.topper added inline comments.Jul 26 2023, 10:13 PM
compiler-rt/lib/builtins/riscv/ifunc_select.c
9

This is bzero rather than memset. memset doesn't write 0.

26

this is memcpy not strncpy. strncpy stops when it encounters the null terminator.

40

efficient*

192

init*

All linux specific stuffs should guarded with __linux__ too, like those syscall stuffs and read /proc/cpuinfo

compiler-rt/lib/builtins/riscv/ifunc_select.c
116

Define 1024 as something like BUFLEN?

188

Try to define those magic number into something __NR_riscv_hwprobe?

BeMg updated this revision to Diff 545064.Jul 28 2023, 1:52 AM
BeMg edited the summary of this revision. (Show Details)
  1. Guard more code with linux
  2. Update function name
  3. Define some marco for system call number and buffer size