Skip to content

fix: Detection of HW caps and Num Cpus for FreeBSD(R) and OpenBSD(R)#1269

Open
Martinfx wants to merge 1 commit intoARM-software:mainfrom
Martinfx:max-freeebsd-fix-ncpu
Open

fix: Detection of HW caps and Num Cpus for FreeBSD(R) and OpenBSD(R)#1269
Martinfx wants to merge 1 commit intoARM-software:mainfrom
Martinfx:max-freeebsd-fix-ncpu

Conversation

@Martinfx
Copy link
Copy Markdown
Contributor

No description provided.

@gunes-arm
Copy link
Copy Markdown
Contributor

Hi @Martinfx , Can you sign-off your commit please. We forgot it in the last PR unfortunately.

@gunes-arm
Copy link
Copy Markdown
Contributor

@Martinfx I also suggest the following commit and pull request title:

fix: Detection of HW caps and Num Cpus for FreeBSD(R) and OpenBSD(R)

@Martinfx Martinfx force-pushed the max-freeebsd-fix-ncpu branch from d90184d to 97df729 Compare March 16, 2026 13:02
@Martinfx Martinfx changed the title fix: detect hw.ncpu for FreeBSD fix: Detection of HW caps and Num Cpus for FreeBSD(R) and OpenBSD(R) Mar 16, 2026
@Martinfx
Copy link
Copy Markdown
Contributor Author

Martinfx commented Mar 16, 2026

Hi @Martinfx , Can you sign-off your commit please. We forgot it in the last PR unfortunately.

ok. no problem.

@gunes-arm
Copy link
Copy Markdown
Contributor

@Martinfx clang-format hook in the pre-commit failed. You'll need to run that pre-commit hook.

@Martinfx Martinfx force-pushed the max-freeebsd-fix-ncpu branch from 5e831a8 to fad3d65 Compare March 24, 2026 17:55
@Martinfx Martinfx requested a review from gunes-arm March 24, 2026 17:57
@Martinfx Martinfx force-pushed the max-freeebsd-fix-ncpu branch 3 times, most recently from 2d8057c to bdadbf6 Compare March 24, 2026 18:26
@Martinfx
Copy link
Copy Markdown
Contributor Author

@gunes-arm sysconf(_SC_NPROCESSORS_ONLN); is also FreeBSD and for OpenBSD. AT_NCPUS is not in OpenBSD elf_aux_info

@Martinfx
Copy link
Copy Markdown
Contributor Author

Hi, @gunes-arm , it is ok ?

@Martinfx Martinfx requested a review from gunes-arm April 5, 2026 23:55
Copy link
Copy Markdown
Contributor

@gunes-arm gunes-arm left a comment

Choose a reason for hiding this comment

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

Hi @Martinfx , thanks for your fixes. It looks good except a few minor things. You should also squash your commits.

@Martinfx Martinfx requested a review from gunes-arm April 7, 2026 18:08
@Martinfx Martinfx force-pushed the max-freeebsd-fix-ncpu branch from 20a4498 to d9f0a9c Compare April 7, 2026 18:12
Copy link
Copy Markdown
Contributor

@gunes-arm gunes-arm left a comment

Choose a reason for hiding this comment

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

I guess there is one more remaining comment to be addressed: https://github.com/ARM-software/ComputeLibrary/pull/1269/changes#r3044146937

@Martinfx
Copy link
Copy Markdown
Contributor Author

Martinfx commented Apr 7, 2026

I guess there is one more remaining comment to be addressed: https://github.com/ARM-software/ComputeLibrary/pull/1269/changes#r3044146937

Yes. I reacted for comment: The problem with aarch64 is here #1274. Is amd64 support?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we're inconsistent here. This elif will be chosen instead of what you implemented below. Therefore, we have to change this as

#elif defined(__arm__) && (defined(__OpenBSD__) || defined(__FreeBSD__))

This is for 32-bit build paths.

The comment next to it should be the previous if statement, i.e.

/* if !defined(_WIN64) && !defined(BARE_METAL) && !defined(__APPLE__) && !defined(__OpenBSD__) &&
    !defined(__FreeBSD__) && !defined(__QNX__) && (defined(__arm__) || defined(__aarch64__)) */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here, the comment should be previous elif, i.e.

/* #elif defined(__arm__) && (defined(__OpenBSD__) || defined(__FreeBSD__)) */

@gunes-arm
Copy link
Copy Markdown
Contributor

I guess there is one more remaining comment to be addressed: https://github.com/ARM-software/ComputeLibrary/pull/1269/changes#r3044146937

Yes. I reacted for comment: The problem with aarch64 is here #1274. Is amd64 support?

I replied in the issue. We do not support/test amd64 builds for anything other than Linux OS. I've posted a few more comments because what you implemented is being shadowed with the code above it.

@Martinfx
Copy link
Copy Markdown
Contributor Author

Martinfx commented Apr 8, 2026

I guess there is one more remaining comment to be addressed: https://github.com/ARM-software/ComputeLibrary/pull/1269/changes#r3044146937

Yes. I reacted for comment: The problem with aarch64 is here #1274. Is amd64 support?

I replied in the issue. We do not support/test amd64 builds for anything other than Linux OS. I've posted a few more comments because what you implemented is being shadowed with the code above it.

ok. thank you for response.

Signed-off-by: Martin Filla <freebsd@sysctl.cz>
@Martinfx Martinfx force-pushed the max-freeebsd-fix-ncpu branch from 70853b4 to e6ab46d Compare April 8, 2026 20:50
@Martinfx Martinfx requested a review from gunes-arm April 8, 2026 20:50
Copy link
Copy Markdown
Contributor

@gunes-arm gunes-arm left a comment

Choose a reason for hiding this comment

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

Thanks for making the changes @Martinfx. Here are my final comments. They're all about code comments, so, I'm going to trigger the CI.

#include <sys/types.h>
#include <unistd.h>
#endif /* #elif (defined(OpenBSD) || defined(FreeBSD)) && defined(aarch64) */
#endif /* #elif (defined(__APPLE__)) && defined(__aarch64__) */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this one is for the outer if, therefore:
/* !defined(_WIN64) */

#include <sys/types.h>
#endif /* defined(__APPLE__) && defined(__aarch64__)) */
#endif /* !defined(BARE_METAL) && !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__QNX__) && (defined(__arm__) || defined(__aarch64__)) */
#elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__aarch64__)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This one should have /* #elif (defined(__APPLE__)) && defined(__aarch64__) */ next to it.

#include <asm/hwcap.h> /* Get HWCAP bits from asm/hwcap.h */
#include <sys/auxv.h>
#elif (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__APPLE__)) && defined(__aarch64__)
#elif (defined(__APPLE__)) && defined(__aarch64__)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This one should have

/* #if !defined(BARE_METAL) && !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && \
    !defined(__QNX__) && (defined(__arm__) || defined(__aarch64__)) */

next to it.

Part of it was already wrong before, so, I'm sorry for that but since we touch it, it'd be good to correct them.

@gunes-arm
Copy link
Copy Markdown
Contributor

The precommit hooks failed on clang-format again. You can check with

pre-commit run clang-format --from-ref=HEAD^ --to-ref=HEAD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants