You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cpuid_arm64.c 18 kB

Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. /**************************************************************************
  2. Copyright (c) 2013, The OpenBLAS Project
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. 1. Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. 2. Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in
  11. the documentation and/or other materials provided with the
  12. distribution.
  13. 3. Neither the name of the OpenBLAS project nor the names of
  14. its contributors may be used to endorse or promote products
  15. derived from this software without specific prior written permission.
  16. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE
  20. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  22. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  23. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  24. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  25. USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. *****************************************************************************/
  27. #include <string.h>
  28. #ifdef __APPLE__
  29. #include <sys/sysctl.h>
  30. int32_t value;
  31. size_t length=sizeof(value);
  32. int64_t value64;
  33. size_t length64=sizeof(value64);
  34. #endif
  35. #define CPU_UNKNOWN 0
  36. #define CPU_ARMV8 1
  37. // Arm
  38. #define CPU_CORTEXA53 2
  39. #define CPU_CORTEXA55 14
  40. #define CPU_CORTEXA57 3
  41. #define CPU_CORTEXA72 4
  42. #define CPU_CORTEXA73 5
  43. #define CPU_NEOVERSEN1 11
  44. #define CPU_NEOVERSEV1 16
  45. #define CPU_NEOVERSEN2 17
  46. #define CPU_CORTEXX1 18
  47. #define CPU_CORTEXX2 19
  48. #define CPU_CORTEXA510 20
  49. #define CPU_CORTEXA710 21
  50. // Qualcomm
  51. #define CPU_FALKOR 6
  52. // Cavium
  53. #define CPU_THUNDERX 7
  54. #define CPU_THUNDERX2T99 8
  55. #define CPU_THUNDERX3T110 12
  56. //Hisilicon
  57. #define CPU_TSV110 9
  58. // Ampere
  59. #define CPU_EMAG8180 10
  60. // Apple
  61. #define CPU_VORTEX 13
  62. // Fujitsu
  63. #define CPU_A64FX 15
  64. // Phytium
  65. #define CPU_FT2000 22
  66. static char *cpuname[] = {
  67. "UNKNOWN",
  68. "ARMV8" ,
  69. "CORTEXA53",
  70. "CORTEXA57",
  71. "CORTEXA72",
  72. "CORTEXA73",
  73. "FALKOR",
  74. "THUNDERX",
  75. "THUNDERX2T99",
  76. "TSV110",
  77. "EMAG8180",
  78. "NEOVERSEN1",
  79. "THUNDERX3T110",
  80. "VORTEX",
  81. "CORTEXA55",
  82. "A64FX",
  83. "NEOVERSEV1",
  84. "NEOVERSEN2",
  85. "CORTEXX1",
  86. "CORTEXX2",
  87. "CORTEXA510",
  88. "CORTEXA710",
  89. "FT2000"
  90. };
  91. static char *cpuname_lower[] = {
  92. "unknown",
  93. "armv8",
  94. "cortexa53",
  95. "cortexa57",
  96. "cortexa72",
  97. "cortexa73",
  98. "falkor",
  99. "thunderx",
  100. "thunderx2t99",
  101. "tsv110",
  102. "emag8180",
  103. "neoversen1",
  104. "thunderx3t110",
  105. "vortex",
  106. "cortexa55",
  107. "a64fx",
  108. "neoversev1",
  109. "neoversen2",
  110. "cortexx1",
  111. "cortexx2",
  112. "cortexa510",
  113. "cortexa710",
  114. "ft2000"
  115. };
  116. int get_feature(char *search)
  117. {
  118. #ifdef __linux
  119. FILE *infile;
  120. char buffer[2048], *p,*t;
  121. p = (char *) NULL ;
  122. infile = fopen("/proc/cpuinfo", "r");
  123. while (fgets(buffer, sizeof(buffer), infile))
  124. {
  125. if (!strncmp("Features", buffer, 8))
  126. {
  127. p = strchr(buffer, ':') + 2;
  128. break;
  129. }
  130. }
  131. fclose(infile);
  132. if( p == NULL ) return 0;
  133. t = strtok(p," ");
  134. while( (t = strtok(NULL," ")))
  135. {
  136. if (!strcmp(t, search)) { return(1); }
  137. }
  138. #endif
  139. return(0);
  140. }
  141. int detect(void)
  142. {
  143. #ifdef __linux
  144. FILE *infile;
  145. char buffer[512], *p, *cpu_part = NULL, *cpu_implementer = NULL;
  146. p = (char *) NULL ;
  147. infile = fopen("/proc/cpuinfo", "r");
  148. while (fgets(buffer, sizeof(buffer), infile)) {
  149. if ((cpu_part != NULL) && (cpu_implementer != NULL)) {
  150. break;
  151. }
  152. if ((cpu_part == NULL) && !strncmp("CPU part", buffer, 8)) {
  153. cpu_part = strchr(buffer, ':') + 2;
  154. cpu_part = strdup(cpu_part);
  155. } else if ((cpu_implementer == NULL) && !strncmp("CPU implementer", buffer, 15)) {
  156. cpu_implementer = strchr(buffer, ':') + 2;
  157. cpu_implementer = strdup(cpu_implementer);
  158. }
  159. }
  160. fclose(infile);
  161. if(cpu_part != NULL && cpu_implementer != NULL) {
  162. // Arm
  163. if (strstr(cpu_implementer, "0x41")) {
  164. if (strstr(cpu_part, "0xd03"))
  165. return CPU_CORTEXA53;
  166. else if (strstr(cpu_part, "0xd07"))
  167. return CPU_CORTEXA57;
  168. else if (strstr(cpu_part, "0xd08"))
  169. return CPU_CORTEXA72;
  170. else if (strstr(cpu_part, "0xd09"))
  171. return CPU_CORTEXA73;
  172. else if (strstr(cpu_part, "0xd0c"))
  173. return CPU_NEOVERSEN1;
  174. else if (strstr(cpu_part, "0xd40"))
  175. return CPU_NEOVERSEV1;
  176. else if (strstr(cpu_part, "0xd49"))
  177. return CPU_NEOVERSEN2;
  178. else if (strstr(cpu_part, "0xd05"))
  179. return CPU_CORTEXA55;
  180. else if (strstr(cpu_part, "0xd46"))
  181. return CPU_CORTEXA510;
  182. else if (strstr(cpu_part, "0xd47"))
  183. return CPU_CORTEXA710;
  184. else if (strstr(cpu_part, "0xd4d")) //A715
  185. return CPU_CORTEXA710;
  186. else if (strstr(cpu_part, "0xd44"))
  187. return CPU_CORTEXX1;
  188. else if (strstr(cpu_part, "0xd4c"))
  189. return CPU_CORTEXX2;
  190. else if (strstr(cpu_part, "0xd4e")) //X3
  191. return CPU_CORTEXX2;
  192. }
  193. // Qualcomm
  194. else if (strstr(cpu_implementer, "0x51") && strstr(cpu_part, "0xc00"))
  195. return CPU_FALKOR;
  196. // Cavium
  197. else if (strstr(cpu_implementer, "0x43") && strstr(cpu_part, "0x0a1"))
  198. return CPU_THUNDERX;
  199. else if (strstr(cpu_implementer, "0x43") && strstr(cpu_part, "0x0af"))
  200. return CPU_THUNDERX2T99;
  201. else if (strstr(cpu_implementer, "0x43") && strstr(cpu_part, "0x0b8"))
  202. return CPU_THUNDERX3T110;
  203. // HiSilicon
  204. else if (strstr(cpu_implementer, "0x48") && strstr(cpu_part, "0xd01"))
  205. return CPU_TSV110;
  206. // Ampere
  207. else if (strstr(cpu_implementer, "0x50") && strstr(cpu_part, "0x000"))
  208. return CPU_EMAG8180;
  209. // Fujitsu
  210. else if (strstr(cpu_implementer, "0x46") && strstr(cpu_part, "0x001"))
  211. return CPU_A64FX;
  212. // Apple
  213. else if (strstr(cpu_implementer, "0x61") && strstr(cpu_part, "0x022"))
  214. return CPU_VORTEX;
  215. // Phytium
  216. else if (strstr(cpu_implementer, "0x70") && (strstr(cpu_part, "0x660") || strstr(cpu_part, "0x661")
  217. || strstr(cpu_part, "0x662") || strstr(cpu_part, "0x663")))
  218. return CPU_FT2000;
  219. }
  220. p = (char *) NULL ;
  221. infile = fopen("/proc/cpuinfo", "r");
  222. while (fgets(buffer, sizeof(buffer), infile))
  223. {
  224. if ((!strncmp("model name", buffer, 10)) || (!strncmp("Processor", buffer, 9)) ||
  225. (!strncmp("CPU architecture", buffer, 16)))
  226. {
  227. p = strchr(buffer, ':') + 2;
  228. break;
  229. }
  230. }
  231. fclose(infile);
  232. if(p != NULL)
  233. {
  234. if ((strstr(p, "AArch64")) || (strstr(p, "8")))
  235. {
  236. return CPU_ARMV8;
  237. }
  238. }
  239. #else
  240. #ifdef __APPLE__
  241. sysctlbyname("hw.cpufamily",&value64,&length64,NULL,0);
  242. if (value64 ==131287967|| value64 == 458787763 ) return CPU_VORTEX; //A12/M1
  243. if (value64 == 3660830781) return CPU_VORTEX; //A15/M2
  244. #endif
  245. return CPU_ARMV8;
  246. #endif
  247. return CPU_UNKNOWN;
  248. }
  249. char *get_corename(void)
  250. {
  251. return cpuname[detect()];
  252. }
  253. void get_architecture(void)
  254. {
  255. printf("ARM64");
  256. }
  257. void get_subarchitecture(void)
  258. {
  259. int d = detect();
  260. printf("%s", cpuname[d]);
  261. }
  262. void get_subdirname(void)
  263. {
  264. printf("arm64");
  265. }
  266. void get_cpucount(void)
  267. {
  268. int n=0;
  269. #ifdef __linux
  270. FILE *infile;
  271. char buffer[2048], *p,*t;
  272. p = (char *) NULL ;
  273. infile = fopen("/proc/cpuinfo", "r");
  274. while (fgets(buffer, sizeof(buffer), infile))
  275. {
  276. if (!strncmp("processor", buffer, 9))
  277. n++;
  278. }
  279. fclose(infile);
  280. printf("#define NUM_CORES %d\n",n);
  281. #endif
  282. #ifdef __APPLE__
  283. sysctlbyname("hw.physicalcpu_max",&value,&length,NULL,0);
  284. printf("#define NUM_CORES %d\n",value);
  285. #endif
  286. }
  287. void get_cpuconfig(void)
  288. {
  289. // All arches should define ARMv8
  290. printf("#define ARMV8\n");
  291. printf("#define HAVE_NEON\n"); // This shouldn't be necessary
  292. printf("#define HAVE_VFPV4\n"); // This shouldn't be necessary
  293. int d = detect();
  294. switch (d)
  295. {
  296. case CPU_CORTEXA53:
  297. case CPU_CORTEXA55:
  298. printf("#define %s\n", cpuname[d]);
  299. // Fall-through
  300. case CPU_ARMV8:
  301. // Minimum parameters for ARMv8 (based on A53)
  302. printf("#define L1_DATA_SIZE 32768\n");
  303. printf("#define L1_DATA_LINESIZE 64\n");
  304. printf("#define L2_SIZE 262144\n");
  305. printf("#define L2_LINESIZE 64\n");
  306. printf("#define DTB_DEFAULT_ENTRIES 64\n");
  307. printf("#define DTB_SIZE 4096\n");
  308. printf("#define L2_ASSOCIATIVE 4\n");
  309. break;
  310. case CPU_CORTEXA57:
  311. case CPU_CORTEXA72:
  312. case CPU_CORTEXA73:
  313. // Common minimum settings for these Arm cores
  314. // Can change a lot, but we need to be conservative
  315. // TODO: detect info from /sys if possible
  316. printf("#define %s\n", cpuname[d]);
  317. printf("#define L1_CODE_SIZE 49152\n");
  318. printf("#define L1_CODE_LINESIZE 64\n");
  319. printf("#define L1_CODE_ASSOCIATIVE 3\n");
  320. printf("#define L1_DATA_SIZE 32768\n");
  321. printf("#define L1_DATA_LINESIZE 64\n");
  322. printf("#define L1_DATA_ASSOCIATIVE 2\n");
  323. printf("#define L2_SIZE 524288\n");
  324. printf("#define L2_LINESIZE 64\n");
  325. printf("#define L2_ASSOCIATIVE 16\n");
  326. printf("#define DTB_DEFAULT_ENTRIES 64\n");
  327. printf("#define DTB_SIZE 4096\n");
  328. break;
  329. case CPU_NEOVERSEN1:
  330. printf("#define %s\n", cpuname[d]);
  331. printf("#define L1_CODE_SIZE 65536\n");
  332. printf("#define L1_CODE_LINESIZE 64\n");
  333. printf("#define L1_CODE_ASSOCIATIVE 4\n");
  334. printf("#define L1_DATA_SIZE 65536\n");
  335. printf("#define L1_DATA_LINESIZE 64\n");
  336. printf("#define L1_DATA_ASSOCIATIVE 4\n");
  337. printf("#define L2_SIZE 1048576\n");
  338. printf("#define L2_LINESIZE 64\n");
  339. printf("#define L2_ASSOCIATIVE 8\n");
  340. printf("#define DTB_DEFAULT_ENTRIES 48\n");
  341. printf("#define DTB_SIZE 4096\n");
  342. break;
  343. case CPU_NEOVERSEV1:
  344. printf("#define %s\n", cpuname[d]);
  345. printf("#define L1_CODE_SIZE 65536\n");
  346. printf("#define L1_CODE_LINESIZE 64\n");
  347. printf("#define L1_CODE_ASSOCIATIVE 4\n");
  348. printf("#define L1_DATA_SIZE 65536\n");
  349. printf("#define L1_DATA_LINESIZE 64\n");
  350. printf("#define L1_DATA_ASSOCIATIVE 4\n");
  351. printf("#define L2_SIZE 1048576\n");
  352. printf("#define L2_LINESIZE 64\n");
  353. printf("#define L2_ASSOCIATIVE 8\n");
  354. printf("#define DTB_DEFAULT_ENTRIES 48\n");
  355. printf("#define DTB_SIZE 4096\n");
  356. break;
  357. case CPU_NEOVERSEN2:
  358. printf("#define %s\n", cpuname[d]);
  359. printf("#define L1_CODE_SIZE 65536\n");
  360. printf("#define L1_CODE_LINESIZE 64\n");
  361. printf("#define L1_CODE_ASSOCIATIVE 4\n");
  362. printf("#define L1_DATA_SIZE 65536\n");
  363. printf("#define L1_DATA_LINESIZE 64\n");
  364. printf("#define L1_DATA_ASSOCIATIVE 4\n");
  365. printf("#define L2_SIZE 1048576\n");
  366. printf("#define L2_LINESIZE 64\n");
  367. printf("#define L2_ASSOCIATIVE 8\n");
  368. printf("#define DTB_DEFAULT_ENTRIES 48\n");
  369. printf("#define DTB_SIZE 4096\n");
  370. break;
  371. case CPU_CORTEXA510:
  372. case CPU_CORTEXA710:
  373. case CPU_CORTEXX1:
  374. case CPU_CORTEXX2:
  375. printf("#define ARMV9\n");
  376. printf("#define %s\n", cpuname[d]);
  377. printf("#define L1_CODE_SIZE 65536\n");
  378. printf("#define L1_CODE_LINESIZE 64\n");
  379. printf("#define L1_CODE_ASSOCIATIVE 4\n");
  380. printf("#define L1_DATA_SIZE 65536\n");
  381. printf("#define L1_DATA_LINESIZE 64\n");
  382. printf("#define L1_DATA_ASSOCIATIVE 4\n");
  383. printf("#define L2_SIZE 1048576\n");
  384. printf("#define L2_LINESIZE 64\n");
  385. printf("#define L2_ASSOCIATIVE 8\n");
  386. printf("#define DTB_DEFAULT_ENTRIES 64\n");
  387. printf("#define DTB_SIZE 4096\n");
  388. break;
  389. case CPU_FALKOR:
  390. printf("#define FALKOR\n");
  391. printf("#define L1_CODE_SIZE 65536\n");
  392. printf("#define L1_CODE_LINESIZE 64\n");
  393. printf("#define L1_DATA_SIZE 32768\n");
  394. printf("#define L1_DATA_LINESIZE 128\n");
  395. printf("#define L2_SIZE 524288\n");
  396. printf("#define L2_LINESIZE 64\n");
  397. printf("#define DTB_DEFAULT_ENTRIES 64\n");
  398. printf("#define DTB_SIZE 4096\n");
  399. printf("#define L2_ASSOCIATIVE 16\n");
  400. break;
  401. case CPU_THUNDERX:
  402. printf("#define THUNDERX\n");
  403. printf("#define L1_DATA_SIZE 32768\n");
  404. printf("#define L1_DATA_LINESIZE 128\n");
  405. printf("#define L2_SIZE 16777216\n");
  406. printf("#define L2_LINESIZE 128\n");
  407. printf("#define DTB_DEFAULT_ENTRIES 64\n");
  408. printf("#define DTB_SIZE 4096\n");
  409. printf("#define L2_ASSOCIATIVE 16\n");
  410. break;
  411. case CPU_THUNDERX2T99:
  412. printf("#define THUNDERX2T99 \n");
  413. printf("#define L1_CODE_SIZE 32768 \n");
  414. printf("#define L1_CODE_LINESIZE 64 \n");
  415. printf("#define L1_CODE_ASSOCIATIVE 8 \n");
  416. printf("#define L1_DATA_SIZE 32768 \n");
  417. printf("#define L1_DATA_LINESIZE 64 \n");
  418. printf("#define L1_DATA_ASSOCIATIVE 8 \n");
  419. printf("#define L2_SIZE 262144 \n");
  420. printf("#define L2_LINESIZE 64 \n");
  421. printf("#define L2_ASSOCIATIVE 8 \n");
  422. printf("#define L3_SIZE 33554432 \n");
  423. printf("#define L3_LINESIZE 64 \n");
  424. printf("#define L3_ASSOCIATIVE 32 \n");
  425. printf("#define DTB_DEFAULT_ENTRIES 64 \n");
  426. printf("#define DTB_SIZE 4096 \n");
  427. break;
  428. case CPU_TSV110:
  429. printf("#define TSV110 \n");
  430. printf("#define L1_CODE_SIZE 65536 \n");
  431. printf("#define L1_CODE_LINESIZE 64 \n");
  432. printf("#define L1_CODE_ASSOCIATIVE 4 \n");
  433. printf("#define L1_DATA_SIZE 65536 \n");
  434. printf("#define L1_DATA_LINESIZE 64 \n");
  435. printf("#define L1_DATA_ASSOCIATIVE 4 \n");
  436. printf("#define L2_SIZE 524228 \n");
  437. printf("#define L2_LINESIZE 64 \n");
  438. printf("#define L2_ASSOCIATIVE 8 \n");
  439. printf("#define DTB_DEFAULT_ENTRIES 64 \n");
  440. printf("#define DTB_SIZE 4096 \n");
  441. break;
  442. case CPU_EMAG8180:
  443. // Minimum parameters for ARMv8 (based on A53)
  444. printf("#define EMAG8180\n");
  445. printf("#define L1_CODE_SIZE 32768\n");
  446. printf("#define L1_DATA_SIZE 32768\n");
  447. printf("#define L1_DATA_LINESIZE 64\n");
  448. printf("#define L2_SIZE 262144\n");
  449. printf("#define L2_LINESIZE 64\n");
  450. printf("#define DTB_DEFAULT_ENTRIES 64\n");
  451. printf("#define DTB_SIZE 4096\n");
  452. break;
  453. case CPU_THUNDERX3T110:
  454. printf("#define THUNDERX3T110 \n");
  455. printf("#define L1_CODE_SIZE 65536 \n");
  456. printf("#define L1_CODE_LINESIZE 64 \n");
  457. printf("#define L1_CODE_ASSOCIATIVE 8 \n");
  458. printf("#define L1_DATA_SIZE 32768 \n");
  459. printf("#define L1_DATA_LINESIZE 64 \n");
  460. printf("#define L1_DATA_ASSOCIATIVE 8 \n");
  461. printf("#define L2_SIZE 524288 \n");
  462. printf("#define L2_LINESIZE 64 \n");
  463. printf("#define L2_ASSOCIATIVE 8 \n");
  464. printf("#define L3_SIZE 94371840 \n");
  465. printf("#define L3_LINESIZE 64 \n");
  466. printf("#define L3_ASSOCIATIVE 32 \n");
  467. printf("#define DTB_DEFAULT_ENTRIES 64 \n");
  468. printf("#define DTB_SIZE 4096 \n");
  469. break;
  470. case CPU_VORTEX:
  471. printf("#define VORTEX \n");
  472. #ifdef __APPLE__
  473. sysctlbyname("hw.l1icachesize",&value64,&length64,NULL,0);
  474. printf("#define L1_CODE_SIZE %lld \n",value64);
  475. sysctlbyname("hw.cachelinesize",&value64,&length64,NULL,0);
  476. printf("#define L1_CODE_LINESIZE %lld \n",value64);
  477. sysctlbyname("hw.l1dcachesize",&value64,&length64,NULL,0);
  478. printf("#define L1_DATA_SIZE %lld \n",value64);
  479. sysctlbyname("hw.l2cachesize",&value64,&length64,NULL,0);
  480. printf("#define L2_SIZE %lld \n",value64);
  481. #endif
  482. printf("#define DTB_DEFAULT_ENTRIES 64 \n");
  483. printf("#define DTB_SIZE 4096 \n");
  484. break;
  485. case CPU_A64FX:
  486. printf("#define A64FX\n");
  487. printf("#define L1_CODE_SIZE 65535\n");
  488. printf("#define L1_DATA_SIZE 65535\n");
  489. printf("#define L1_DATA_LINESIZE 256\n");
  490. printf("#define L2_SIZE 8388608\n");
  491. printf("#define L2_LINESIZE 256\n");
  492. printf("#define DTB_DEFAULT_ENTRIES 64\n");
  493. printf("#define DTB_SIZE 4096\n");
  494. break;
  495. case CPU_FT2000:
  496. printf("#define FT2000\n");
  497. printf("#define L1_CODE_SIZE 32768\n");
  498. printf("#define L1_DATA_SIZE 32768\n");
  499. printf("#define L1_DATA_LINESIZE 64\n");
  500. printf("#define L2_SIZE 33554432\n");
  501. printf("#define L2_LINESIZE 64\n");
  502. printf("#define DTB_DEFAULT_ENTRIES 64\n");
  503. printf("#define DTB_SIZE 4096\n");
  504. break;
  505. }
  506. get_cpucount();
  507. }
  508. void get_libname(void)
  509. {
  510. int d = detect();
  511. printf("%s", cpuname_lower[d]);
  512. }
  513. void get_features(void)
  514. {
  515. #ifdef __linux
  516. FILE *infile;
  517. char buffer[2048], *p,*t;
  518. p = (char *) NULL ;
  519. infile = fopen("/proc/cpuinfo", "r");
  520. while (fgets(buffer, sizeof(buffer), infile))
  521. {
  522. if (!strncmp("Features", buffer, 8))
  523. {
  524. p = strchr(buffer, ':') + 2;
  525. break;
  526. }
  527. }
  528. fclose(infile);
  529. if( p == NULL ) return;
  530. t = strtok(p," ");
  531. while( (t = strtok(NULL," ")))
  532. {
  533. }
  534. #endif
  535. return;
  536. }