We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://docs.modular.com/mojo/stdlib/builtin/constrained/constrained/
The code on this page gives a compile error (see also #3683)
from sys.info import num_physical_cores def main(): alias cores_to_use = 2 multicore_check[cores_to_use]() def multicore_check[cores: Int](): constrained[ cores <= num_physical_cores(), "build failed: not enough cores" ]() constrained[ cores >= 2, "at least two cores are required" ]()
The error is:
open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:114:4: error: call expansion failed open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:97:4: note: function instantiation failed open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:109:57: note: call expansion failed open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:69:4: note: function instantiation failed open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:85:18: note: call expansion failed open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:106:8: note: function instantiation failed /home/ivo/mojo_book/using_functions/test.mojo:6:34: note: call expansion failed multicore_checkcores_to_use ^ /home/ivo/mojo_book/using_functions/test.mojo:9:5: note: function instantiation failed def multicore_checkcores: Int: ^ /home/ivo/mojo_book/using_functions/test.mojo:12:6: note: call expansion failed ]() ^ open-source/mojo/stdlib/stdlib/builtin/constrained.mojo:56:6: note: failed to compile-time evaluate function call open-source/mojo/stdlib/stdlib/sys/info.mojo:789:4: note: failed to interpret function @StdLib::sys::info::num_physical_cores() open-source/mojo/stdlib/stdlib/sys/info.mojo:796:73: note: call expansion failed open-source/mojo/stdlib/stdlib/sys/ffi.mojo:624:6: note: failed to interpret operation pop.external_call{func: "KGEN_CompilerRT_NumPhysicalCores" : !kgen.string, funcAttrs: ["willreturn"], memory: #llvm.memory_effects<other = none, argMem = none, inaccessibleMem = none>, resAttrs: [{llvm.noundef}]}(#kgen.pack<> : !kgen.pack<[]>) open-source/mojo/stdlib/stdlib/sys/info.mojo:796:73: note: call expansion failed open-source/mojo/stdlib/stdlib/sys/ffi.mojo:624:6: note: unable to interpret call to unknown external function: KGEN_CompilerRT_NumPhysicalCores mojo: error: failed to run the pass manager
No response
The text was updated successfully, but these errors were encountered:
Reproduced. Thanks for filing.
Sorry, something went wrong.
arthurevans
No branches or pull requests
Where is the problem?
https://docs.modular.com/mojo/stdlib/builtin/constrained/constrained/
What can we do better?
The code on this page gives a compile error (see also #3683)
The error is:
open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:114:4: error: call expansion failed
open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:97:4: note: function instantiation failed
open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:109:57: note: call expansion failed
open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:69:4: note: function instantiation failed
open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:85:18: note: call expansion failed
open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:106:8: note: function instantiation failed
/home/ivo/mojo_book/using_functions/test.mojo:6:34: note: call expansion failed
multicore_checkcores_to_use
^
/home/ivo/mojo_book/using_functions/test.mojo:9:5: note: function instantiation failed
def multicore_checkcores: Int:
^
/home/ivo/mojo_book/using_functions/test.mojo:12:6: note: call expansion failed
]()
^
open-source/mojo/stdlib/stdlib/builtin/constrained.mojo:56:6: note: failed to compile-time evaluate function call
open-source/mojo/stdlib/stdlib/sys/info.mojo:789:4: note: failed to interpret function @StdLib::sys::info::num_physical_cores()
open-source/mojo/stdlib/stdlib/sys/info.mojo:796:73: note: call expansion failed
open-source/mojo/stdlib/stdlib/sys/ffi.mojo:624:6: note: failed to interpret operation pop.external_call{func: "KGEN_CompilerRT_NumPhysicalCores" : !kgen.string, funcAttrs: ["willreturn"], memory: #llvm.memory_effects<other = none, argMem = none, inaccessibleMem = none>, resAttrs: [{llvm.noundef}]}(#kgen.pack<> : !kgen.pack<[]>)
open-source/mojo/stdlib/stdlib/sys/info.mojo:796:73: note: call expansion failed
open-source/mojo/stdlib/stdlib/sys/ffi.mojo:624:6: note: unable to interpret call to unknown external function: KGEN_CompilerRT_NumPhysicalCores
mojo: error: failed to run the pass manager
Anything else?
No response
The text was updated successfully, but these errors were encountered: