Skip to content

Add FEATURE_JIT_SIMD option #966

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

Open
wants to merge 1 commit into
base: pharo-12
Choose a base branch
from

Conversation

guillep
Copy link
Member

@guillep guillep commented Apr 30, 2025

  • Make JIT SIMD optional with <option: #FEATURE_JIT_SIMD>
  • Add option FEATURE_JIT_SIMD to CMakeLists.txt
  • Add FEATURE_JIT_SIMD as a compile time option

- Make JIT SIMD optional with <option: #FEATURE_JIT_SIMD>
- Add option FEATURE_JIT_SIMD to CMakeLists.txt
- Add FEATURE_JIT_SIMD as a compile time option
Comment on lines +20 to +48
option(VERBOSE_BUILD "Verbose Build" OFF)
option(FEATURE_FFI "Enable FFI" ON)
option(FEATURE_THREADED_FFI "Enable Threaded (running in another thread) FFI" ON)
option(FEATURE_MESSAGE_COUNT "Enable the option to count messages, only valid for StackVM" OFF)
option(FEATURE_NETWORK "Enable network and sockets" ON)
option(FEATURE_JIT_SIMD "Use SIMD support in JIT compilation when available" ON)
option(FEATURE_LIB_SDL2 "Build SDL2 support" ON)
option(FEATURE_LIB_CAIRO "Build Cairo support" ON)
option(FEATURE_LIB_FREETYPE2 "Build freetype2 support" ON)
option(FEATURE_LIB_GIT2 "Build LibGit2 support" ON)
option(FEATURE_LIB_PTHREADW32 "Windows only, link to win32 version of pthread" OFF)
option(GENERATE_VMMAKER "If it generates the VMMaker image" ON)
option(GENERATE_SOURCES "If it generates the C sources" ON)
option(ALWAYS_INTERACTIVE "Be interactive by default" OFF)
option(BUILD_BUNDLE "Builds a bundle with all dependencies" ON)
option(FEATURE_COMPILE_GNUISATION
"Use gcc gnu extensions to compile the VM" ON)
option(FEATURE_COMPILE_INLINE_MEMORY_ACCESSORS
"Use inline memory accessors instead of macros" ON)
option(PHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES
"Prefer downloading dependencies" OFF)
option(PHARO_VM_IN_WORKER_THREAD
"Run the VM in a thread different that the main" ON)
option(DEPENDENCIES_FORCE_BUILD
"Force build libraries" OFF)
option(BUILD_WITH_GRAPHVIZ
"Generate dependency graphs" ON)
option(VERSION_UPDATE_FROM_GIT
"Extract version information from git tags. Default to true. Follow vX.Y.Z-suffix" ON)
Copy link
Member Author

Choose a reason for hiding this comment

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

I formatted a bit this code, the actually important line is line 25 adding

FEATURE_JIT_SIMD

Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you formatted or unformatted the code 😆

Comment on lines -251 to -254
if (${FEATURE_COMPILE_INLINE_MEMORY_ACCESSORS})
add_compile_definitions(USE_INLINE_MEMORY_ACCESSORS=1)
endif()

Copy link
Member Author

Choose a reason for hiding this comment

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

I cleaned a bit these compile time definitions to make them local to the VM library compilation and not global options to the entire project.

@@ -99,6 +99,7 @@ VMBasicConstants class >> namesDefinedAtCompileTime [
will be emitted within #if defined(ANameDefinedAtCompileTime)...#endif."
^#( VMBIGENDIAN
IMMUTABILITY
FEATURE_JIT_SIMD
Copy link
Member Author

Choose a reason for hiding this comment

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

It would be nice to move this VMBasicConstants class >> namesDefinedAtCompileTime somewhere else, it looks like a strange dependency.

Comment on lines -4279 to -4285
{ #category : 'testing' }
CogX64Compiler >> checkIs32bit: offset [

(offset between: -2147483648 and: 2147483647) ifFalse: [
self error: 'Cannot jump to distances larger than 32 bits' ]
]

Copy link
Member Author

Choose a reason for hiding this comment

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

This method has just been reordered by tonel...

Copy link
Collaborator

@PalumboN PalumboN left a comment

Choose a reason for hiding this comment

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

Niceeee 🪂 🧨

Comment on lines +20 to +48
option(VERBOSE_BUILD "Verbose Build" OFF)
option(FEATURE_FFI "Enable FFI" ON)
option(FEATURE_THREADED_FFI "Enable Threaded (running in another thread) FFI" ON)
option(FEATURE_MESSAGE_COUNT "Enable the option to count messages, only valid for StackVM" OFF)
option(FEATURE_NETWORK "Enable network and sockets" ON)
option(FEATURE_JIT_SIMD "Use SIMD support in JIT compilation when available" ON)
option(FEATURE_LIB_SDL2 "Build SDL2 support" ON)
option(FEATURE_LIB_CAIRO "Build Cairo support" ON)
option(FEATURE_LIB_FREETYPE2 "Build freetype2 support" ON)
option(FEATURE_LIB_GIT2 "Build LibGit2 support" ON)
option(FEATURE_LIB_PTHREADW32 "Windows only, link to win32 version of pthread" OFF)
option(GENERATE_VMMAKER "If it generates the VMMaker image" ON)
option(GENERATE_SOURCES "If it generates the C sources" ON)
option(ALWAYS_INTERACTIVE "Be interactive by default" OFF)
option(BUILD_BUNDLE "Builds a bundle with all dependencies" ON)
option(FEATURE_COMPILE_GNUISATION
"Use gcc gnu extensions to compile the VM" ON)
option(FEATURE_COMPILE_INLINE_MEMORY_ACCESSORS
"Use inline memory accessors instead of macros" ON)
option(PHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES
"Prefer downloading dependencies" OFF)
option(PHARO_VM_IN_WORKER_THREAD
"Run the VM in a thread different that the main" ON)
option(DEPENDENCIES_FORCE_BUILD
"Force build libraries" OFF)
option(BUILD_WITH_GRAPHVIZ
"Generate dependency graphs" ON)
option(VERSION_UPDATE_FROM_GIT
"Extract version information from git tags. Default to true. Follow vX.Y.Z-suffix" ON)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you formatted or unformatted the code 😆

@PalumboN
Copy link
Collaborator

There are related failing tests:

VM Unit Tests / MacOSX64.VMMakerTests.VMJitVectorMethodTest.testJitCompiledFloat32VectorAddition(#ISA->#X64 #wordSize->8 #useComposedImageFormat->true) (from VMMakerTests)

Error
VM built without SIMD support
StackToRegisterMappingCogit(Object)>>error:
[ self error: 'VM built without SIMD support' ] in StackToRegisterMappingCogit>>genMappedInlinePrimitive:
False>>ifTrue:ifFalse:
StackToRegisterMappingCogit(SlangClass)>>cppIf:ifTrue:ifFalse:
StackToRegisterMappingCogit>>genMappedInlinePrimitive:
StackToRegisterMappingCogit>>genCallMappedInlinedPrimitive
StackToRegisterMappingCogit>>compileAbstractInstructionsFrom:through:
StackToRegisterMappingCogit(Cogit)>>compileMethodBody
StackToRegisterMappingCogit(Cogit)>>compileEntireMethod
StackToRegisterMappingCogit>>compileEntireMethod
StackToRegisterMappingCogit(Cogit)>>compileCogMethod:
StackToRegisterMappingCogit>>compileCogMethod:
StackToRegisterMappingCogit(Cogit)>>cog:selector:
VMJitVectorMethodTest(VMSimpleStackBasedCogitAbstractTest)>>jitMethod:selector:
VMJitVectorMethodTest(VMSimpleStackBasedCogitAbstractTest)>>jitMethod:
VMJitVectorMethodTest>>testJitCompiledFloat32VectorAddition
VMJitVectorMethodTest(TestCase)>>performTest

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