{"action":"created","issue":{"url":"https://api.github.com/repos/zfsonlinux/zfs/issues/4381","repository_url":"https://api.github.com/repos/zfsonlinux/zfs","labels_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/4381/labels{/name}","comments_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/4381/comments","events_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/4381/events","html_url":"https://github.com/zfsonlinux/zfs/pull/4381","id":137337645,"number":4381,"title":"Support for vectorized algorithms on x86","user":{"login":"ironMann","id":276684,"avatar_url":"https://avatars.githubusercontent.com/u/276684?v=3","gravatar_id":"","url":"https://api.github.com/users/ironMann","html_url":"https://github.com/ironMann","followers_url":"https://api.github.com/users/ironMann/followers","following_url":"https://api.github.com/users/ironMann/following{/other_user}","gists_url":"https://api.github.com/users/ironMann/gists{/gist_id}","starred_url":"https://api.github.com/users/ironMann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ironMann/subscriptions","organizations_url":"https://api.github.com/users/ironMann/orgs","repos_url":"https://api.github.com/users/ironMann/repos","events_url":"https://api.github.com/users/ironMann/events{/privacy}","received_events_url":"https://api.github.com/users/ironMann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-29T18:52:01Z","updated_at":"2016-03-10T20:25:31Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zfsonlinux/zfs/pulls/4381","html_url":"https://github.com/zfsonlinux/zfs/pull/4381","diff_url":"https://github.com/zfsonlinux/zfs/pull/4381.diff","patch_url":"https://github.com/zfsonlinux/zfs/pull/4381.patch"},"body":"This is initial support for x86 vectorized implementations of ZFS parity\r\nand checksum algorithms.\r\n\r\nFor the compilation phase, configure step checks if toolchain supports relevant\r\ninstruction sets. Each implementation must ensure that the code is not passed\r\nto compiler if relevant instruction set is not supported. For this purpose,\r\nfollowing new defines are provided if instruction set is supported:\r\n\t- HAVE_SSE,\r\n\t- HAVE_SSE2,\r\n\t- HAVE_SSE3,\r\n\t- HAVE_SSSE3,\r\n\t- HAVE_SSE4_1,\r\n\t- HAVE_SSE4_2,\r\n\t- HAVE_AVX,\r\n\t- HAVE_AVX2.\r\n\r\nFor detecting if an instruction set can be used in runtime, following functions\r\nare provided in [simd_x86.h:](https://github.com/ironMann/zfs/blob/simd-01/include/linux/simd_x86.h#L172-L286)\r\n\t- sse_available()\r\n\t- sse2_available()\r\n\t- sse3_available()\r\n\t- ssse3_available()\r\n\t- sse4_1_available()\r\n\t- sse4_2_available()\r\n\t- avx_available()\r\n\t- avx2_available()\r\n\r\nThese function should be called once, on module load, or initialization. \r\nThey are safe to use from user and kernel space.\r\n\r\nIf an implementation is using more than single instruction set, both compiler\r\nand runtime support for all relevant instruction sets should be checked.\r\n\r\nThis is relevant for:\r\n#2351 - sha256 avx optimization\r\n#3374 - raidz avx/avx2/sse optimization\r\n#4328 - raidz avl/av2/sse optimization\r\n#4330 - fletcher avl optimzation"},"comment":{"url":"https://api.github.com/repos/zfsonlinux/zfs/issues/comments/195032551","html_url":"https://github.com/zfsonlinux/zfs/pull/4381#issuecomment-195032551","issue_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/4381","id":195032551,"user":{"login":"ironMann","id":276684,"avatar_url":"https://avatars.githubusercontent.com/u/276684?v=3","gravatar_id":"","url":"https://api.github.com/users/ironMann","html_url":"https://github.com/ironMann","followers_url":"https://api.github.com/users/ironMann/followers","following_url":"https://api.github.com/users/ironMann/following{/other_user}","gists_url":"https://api.github.com/users/ironMann/gists{/gist_id}","starred_url":"https://api.github.com/users/ironMann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ironMann/subscriptions","organizations_url":"https://api.github.com/users/ironMann/orgs","repos_url":"https://api.github.com/users/ironMann/repos","events_url":"https://api.github.com/users/ironMann/events{/privacy}","received_events_url":"https://api.github.com/users/ironMann/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T20:25:31Z","updated_at":"2016-03-10T20:25:31Z","body":"Done.\r\nOne missing piece is to export `kernel_fpu_begin()`/`kernel_fpu_end()` in a portable way. This interface has even switched to EXPORT_GPL recently (taking down some GPU drivers), but I think there is a portable way. I'll have to research the options a bit more. "}}