Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CORE] [RISCV] Fix needed for riscv64 #45574

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

smuzaffar
Copy link
Contributor

These changes are needed to build FWCore on riscv64 architecture. @makortel , GetRiscvInfo() returns [a] structure. Let me know if we should include something form RiscvFeatures too.

[a] https://github.com/google/cpu_features/blob/main/include/cpuinfo_riscv.h#L44-L48

typedef struct {
  RiscvFeatures features;
  char uarch[64];   // 0 terminated string
  char vendor[64];  // 0 terminated string
} RiscvInfo;

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 29, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @smuzaffar for master.

It involves the following packages:

  • FWCore/Services (core)
  • FWCore/Utilities (core)

@Dr15Jones, @cmsbuild, @makortel, @smuzaffar can you please review it and eventually sign? Thanks.
@felicepantaleo, @fwyzard, @makortel, @missirol, @wddgit this is something you requested to watch as well.
@antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@@ -28,6 +28,8 @@
#include "cpu_features/cpuinfo_aarch64.h"
#elif defined(CPU_FEATURES_ARCH_PPC)
#include "cpu_features/cpuinfo_ppc.h"
#elif define(CPU_FEATURES_ARCH_RISCV)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#elif define(CPU_FEATURES_ARCH_RISCV)
#elif defined(CPU_FEATURES_ARCH_RISCV)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah thanks @fwyzard , fixed now

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Pull request #45574 was updated. @Dr15Jones, @cmsbuild, @makortel, @smuzaffar can you please check and sign again.

@smuzaffar
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 24KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-c074d0/40663/summary.html
COMMIT: 10ee381
CMSSW: CMSSW_14_1_X_2024-07-28-2300/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/45574/40663/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

@makortel
Copy link
Contributor

@dan131riley please take a look

@makortel
Copy link
Contributor

Let me know if we should include something form RiscvFeatures too.

I think this is a reasonable start, we can always expand later if something additional seems useful.

@@ -76,6 +76,8 @@ namespace edm {
__asm__ __volatile__("isb; mrs %0, cntvct_el0" : "=r"(ret));
return ret;
}
#elif defined(__riscv)
static __inline__ unsigned long long rdtsc(void) { return 0; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to have a comment here (or a #warning as for ARMv7 above) explaining why this function returns 0 for RISC-V.

(in any case this support does not seem super important in the near or medium term, given that it seems to be used only in handful of unit tests)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@makortel , my bad, I should not have included it here. Looking at https://gist.github.com/XieJiSS/18acd12685ecc0913d43d6bcfb3baefd , I see that there is way to get this info for riscv. You think something like the following should be enough for riscv ?

#elif defined(__riscv) && __riscv_xlen == 64
static __inline__ unsigned long long rdtsc(void)
  uint64_t cycles;
  asm volatile("rdcycle %0" : "=r"(cycles));
  return cycles;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You think something like the following should be enough for riscv ?

#elif defined(__riscv) && __riscv_xlen == 64
static __inline__ unsigned long long rdtsc(void)
  uint64_t cycles;
  asm volatile("rdcycle %0" : "=r"(cycles));
  return cycles;
}

I'm by far not an expert of RISC-V assembly, but based on quick searches it looks a reasonable starting point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@dan131riley
Copy link

Looks reasonable

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Pull request #45574 was updated. @Dr15Jones, @cmsbuild, @makortel, @smuzaffar can you please check and sign again.

@smuzaffar
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 20KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-c074d0/40696/summary.html
COMMIT: ec6a7d1
CMSSW: CMSSW_14_1_X_2024-07-30-2300/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/45574/40696/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

@makortel
Copy link
Contributor

Comparison differences are related to #45505

@makortel
Copy link
Contributor

+core

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @antoniovilela, @sextonkennedy, @mandrenguyen, @rappoccio (and backports should be raised in the release meeting by the corresponding L2)

@mandrenguyen
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit bbaa8dd into cms-sw:master Jul 31, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants