|
14 | 14 | #include "backendllvm.h" |
15 | 15 | #include <OSL/oslquery.h> |
16 | 16 |
|
| 17 | +#include <OpenImageIO/filesystem.h> |
| 18 | +#include <OpenImageIO/fmath.h> |
| 19 | +#include <OpenImageIO/optparser.h> |
17 | 20 | #include <OpenImageIO/strutil.h> |
| 21 | +#include <OpenImageIO/sysutil.h> |
18 | 22 | #include <OpenImageIO/thread.h> |
19 | 23 | #include <OpenImageIO/timer.h> |
20 | | -#include <OpenImageIO/filesystem.h> |
21 | | -#include <OpenImageIO/optparser.h> |
22 | | -#include <OpenImageIO/fmath.h> |
23 | 24 |
|
24 | 25 | #include "opcolor.h" |
25 | 26 |
|
26 | 27 | using namespace OSL; |
27 | 28 | using namespace OSL::pvt; |
28 | 29 |
|
| 30 | +#include <OpenEXR/ImfChannelList.h> // Just for OPENEXR_VERSION_STRING |
| 31 | + |
29 | 32 | // avoid naming conflicts with MSVC macros |
30 | 33 | #ifdef _MSC_VER |
31 | 34 | #undef RGB |
@@ -1772,20 +1775,56 @@ struct group_time_compare { // So looking forward to C++11 lambdas! |
1772 | 1775 |
|
1773 | 1776 |
|
1774 | 1777 |
|
| 1778 | +// Return a comma-separated list of all the important SIMD/capabilities |
| 1779 | +// that were enabled as a compile-time option when OSL was built. |
| 1780 | +// (Keep this in sync with oiio_simd_caps in imageio.cpp). |
| 1781 | +static std::string |
| 1782 | +osl_simd_caps() |
| 1783 | +{ |
| 1784 | + // clang-format off |
| 1785 | + std::vector<string_view> caps; |
| 1786 | + if (OIIO_SIMD_SSE >= 2) caps.emplace_back ("sse2"); |
| 1787 | + if (OIIO_SIMD_SSE >= 3) caps.emplace_back ("sse3"); |
| 1788 | + if (OIIO_SIMD_SSE >= 3) caps.emplace_back ("ssse3"); |
| 1789 | + if (OIIO_SIMD_SSE >= 4) caps.emplace_back ("sse41"); |
| 1790 | + if (OIIO_SIMD_SSE >= 4) caps.emplace_back ("sse42"); |
| 1791 | + if (OIIO_SIMD_AVX) caps.emplace_back ("avx"); |
| 1792 | + if (OIIO_SIMD_AVX >= 2) caps.emplace_back ("avx2"); |
| 1793 | + if (OIIO_SIMD_AVX >= 512) caps.emplace_back ("avx512f"); |
| 1794 | + if (OIIO_AVX512DQ_ENABLED) caps.emplace_back ("avx512dq"); |
| 1795 | + if (OIIO_AVX512IFMA_ENABLED) caps.emplace_back ("avx512ifma"); |
| 1796 | + if (OIIO_AVX512PF_ENABLED) caps.emplace_back ("avx512pf"); |
| 1797 | + if (OIIO_AVX512ER_ENABLED) caps.emplace_back ("avx512er"); |
| 1798 | + if (OIIO_AVX512CD_ENABLED) caps.emplace_back ("avx512cd"); |
| 1799 | + if (OIIO_AVX512BW_ENABLED) caps.emplace_back ("avx512bw"); |
| 1800 | + if (OIIO_AVX512VL_ENABLED) caps.emplace_back ("avx512vl"); |
| 1801 | + if (OIIO_FMA_ENABLED) caps.emplace_back ("fma"); |
| 1802 | + if (OIIO_F16C_ENABLED) caps.emplace_back ("f16c"); |
| 1803 | + // if (OIIO_POPCOUNT_ENABLED) caps.emplace_back ("popcnt"); |
| 1804 | + return OIIO::Strutil::join (caps, ","); |
| 1805 | + // clang-format on |
| 1806 | +} |
| 1807 | + |
| 1808 | + |
| 1809 | + |
1775 | 1810 | std::string |
1776 | 1811 | ShadingSystemImpl::getstats (int level) const |
1777 | 1812 | { |
| 1813 | + int columns = OIIO::Sysutil::terminal_columns() - 2; |
| 1814 | + |
1778 | 1815 | if (level <= 0) |
1779 | 1816 | return ""; |
1780 | 1817 | std::ostringstream out; |
1781 | 1818 | out.imbue (std::locale::classic()); // force C locale |
1782 | | - out << "OSL ShadingSystem statistics (" << (void*)this; |
1783 | | - out << ") ver " << OSL_LIBRARY_VERSION_STRING |
1784 | | - << ", LLVM " << OSL_LLVM_FULL_VERSION << "\n"; |
1785 | | - if (m_stat_shaders_requested == 0 && m_stat_shaders_loaded == 0) { |
1786 | | - out << " No shaders requested or loaded\n"; |
1787 | | - return out.str(); |
1788 | | - } |
| 1819 | + out << "Open Shading Language " << OSL_LIBRARY_VERSION_STRING << "\n"; |
| 1820 | + out << " Build deps: LLVM-" << OSL_LLVM_FULL_VERSION |
| 1821 | + << " OIIO-" << OIIO_VERSION_STRING << " Imath-" << |
| 1822 | +#ifdef OPENEXR_VERSION_STRING |
| 1823 | + OPENEXR_VERSION_STRING |
| 1824 | +#else |
| 1825 | + "(unknown)" |
| 1826 | +#endif |
| 1827 | + << "\n"; |
1789 | 1828 |
|
1790 | 1829 | std::string opt; |
1791 | 1830 | #define BOOLOPT(name) opt += Strutil::sprintf(#name "=%d ", m_##name) |
@@ -1851,7 +1890,28 @@ ShadingSystemImpl::getstats (int level) const |
1851 | 1890 | #undef BOOLOPT |
1852 | 1891 | #undef INTOPT |
1853 | 1892 | #undef STROPT |
1854 | | - out << " Options: " << Strutil::wordwrap(opt, 75, 12) << "\n"; |
| 1893 | + |
| 1894 | + // Print the HW info |
| 1895 | + out << " Build HW support: "; |
| 1896 | + std::string buildsimd = osl_simd_caps(); |
| 1897 | + if (!buildsimd.size()) |
| 1898 | + buildsimd = "no SIMD"; |
| 1899 | + out << buildsimd << "\n"; |
| 1900 | + OIIO::Strutil::fprintf(out, " Runtime HW: %d cores %.1fGB %s\n", |
| 1901 | + OIIO::Sysutil::hardware_concurrency(), |
| 1902 | + OIIO::Sysutil::physical_memory() / float(1 << 30), |
| 1903 | + OIIO::get_string_attribute("hw:simd")); |
| 1904 | + // TODO: detect GPU info and print it here |
| 1905 | + out << "\n"; |
| 1906 | + |
| 1907 | + out << "ShadingSystem Options:\n"; |
| 1908 | + out << " " << Strutil::wordwrap(opt, columns, 4) << "\n"; |
| 1909 | + |
| 1910 | + out << "\nOSL ShadingSystem statistics (" << (void*)this << ")\n"; |
| 1911 | + if (m_stat_shaders_requested == 0 && m_stat_shaders_loaded == 0) { |
| 1912 | + out << " No shaders requested or loaded\n"; |
| 1913 | + return out.str(); |
| 1914 | + } |
1855 | 1915 |
|
1856 | 1916 | out << " Shaders:\n"; |
1857 | 1917 | out << " Requested: " << m_stat_shaders_requested << "\n"; |
|
0 commit comments