René's URL Explorer Experiment


Title: Speed Comparison: BitLinear and nn.Linear · Issue #118 · microsoft/BitBLAS · GitHub

Open Graph Title: Speed Comparison: BitLinear and nn.Linear · Issue #118 · microsoft/BitBLAS

X Title: Speed Comparison: BitLinear and nn.Linear · Issue #118 · microsoft/BitBLAS

Description: Hello, I measured the time of your BitLinear and BitLinearBitBLAS against nn.Linear, and it seems that the time for smaller input_features and out_features is slower than nn.Linear. Is there a solution for this? I used the quant_utils fr...

Open Graph Description: Hello, I measured the time of your BitLinear and BitLinearBitBLAS against nn.Linear, and it seems that the time for smaller input_features and out_features is slower than nn.Linear. Is there a solu...

X Description: Hello, I measured the time of your BitLinear and BitLinearBitBLAS against nn.Linear, and it seems that the time for smaller input_features and out_features is slower than nn.Linear. Is there a solu...

Opengraph URL: https://github.com/microsoft/BitBLAS/issues/118

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Speed Comparison: BitLinear and nn.Linear","articleBody":"Hello,\r\n\r\nI measured the time of your BitLinear and BitLinearBitBLAS against nn.Linear, and it seems that the time for smaller input_features and out_features is slower than nn.Linear. Is there a solution for this?\r\n\r\nI used the quant_utils from your BitNet integration: https://github.com/microsoft/BitBLAS/blob/main/integration/BitNet/utils_quant.py\r\n\r\nMy GPU is NVIDIA GeForce RTX 3090\r\n\r\n```\r\nimport time\r\nimport torch\r\nimport torch.nn as nn\r\nfrom torch.autograd import Variable\r\n\r\n# from bitlinear import BitLinear, BitLinearBitBLAS\r\nfrom utils_quant import BitLinear, BitLinearBitBLAS\r\n\r\n# Function to measure computation time\r\ndef measure_time(layer, input_tensor, num_runs=100):\r\n    with torch.no_grad():\r\n        # Warm up\r\n        for _ in range(100): ## 100\r\n            _ = layer(input_tensor)\r\n        \r\n        start_time = time.time()\r\n        for _ in range(num_runs):\r\n            _ = layer(input_tensor)\r\n        torch.cuda.synchronize()  #### new\r\n        end_time = time.time()\r\n        \r\n        avg_time = (end_time - start_time) / num_runs\r\n    return avg_time\r\n\r\n# # # Test parameters\r\ninput_features = 512\r\noutput_features = 256\r\nbatch_size = 8\r\n\r\n# input_features = 1024\r\n# output_features = 512\r\n# batch_size = 32\r\n\r\n# input_features = 10240\r\n# output_features = 5120\r\n# batch_size = 32\r\n\r\n# input_features = 20480\r\n# output_features = 10240\r\n# batch_size = 32\r\n\r\n\r\n# Create random input tensor\r\ninput_tensor = torch.randn(batch_size, input_features).cuda()\r\n\r\n# Initialize layers\r\nnn_linear_layer = nn.Linear(input_features, output_features).cuda()\r\nbit_linear_layer = BitLinear(input_features, output_features).cuda()\r\n\r\nbitblas_linear_layer = BitLinearBitBLAS.from_bit_linear(bit_linear_layer)\r\n\r\n# Measure computation time\r\nnum_runs = 100\r\nnn_linear_time = measure_time(nn_linear_layer, input_tensor, num_runs)\r\nbit_linear_time = measure_time(bit_linear_layer, input_tensor, num_runs)\r\nbitblas_linear_time = measure_time(bitblas_linear_layer, input_tensor, num_runs)\r\n\r\nprint('input_features, output_features, batch_size: ', input_features, output_features, batch_size)\r\nprint(f\"Average computation time for nn.Linear: {nn_linear_time * 1000:.4f} ms\")\r\nprint(f\"Average computation time for fp32 simulated BitLinear: {bit_linear_time * 1000:.4f} ms\")\r\nprint(f\"Average computation time Bitblas BitLinear: {bitblas_linear_time * 1000:.4f} ms\")\r\n\r\n\r\n```\r\n\r\nHere are the testing results:\r\n\r\n```\r\ninput_features, output_features, batch_size:  512 256 8\r\nAverage computation time for nn.Linear: 0.0230 ms\r\nAverage computation time for fp32 simulated BitLinear: 0.3450 ms\r\nAverage computation time Bitblas BitLinear: 0.3091 ms\r\n\r\ninput_features, output_features, batch_size:  1024 512 32\r\nAverage computation time for nn.Linear: 0.0265 ms\r\nAverage computation time for fp32 simulated BitLinear: 0.3427 ms\r\nAverage computation time Bitblas BitLinear: 0.3137 ms\r\n\r\ninput_features, output_features, batch_size:  10240 5120 32\r\nAverage computation time for nn.Linear: 0.5421 ms\r\nAverage computation time for fp32 simulated BitLinear: 6.3314 ms\r\nAverage computation time Bitblas BitLinear: 0.3170 ms\r\n\r\ninput_features, output_features, batch_size:  20480 10240 32\r\nAverage computation time for nn.Linear: 2.1726 ms\r\nAverage computation time for fp32 simulated BitLinear: 25.2509 ms\r\nAverage computation time Bitblas BitLinear: 0.5633 ms\r\n```\r\n\r\nThanks for your reply in advance.","author":{"url":"https://github.com/ZiqingChang","@type":"Person","name":"ZiqingChang"},"datePublished":"2024-08-01T13:19:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/118/BitBLAS/issues/118"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b1aa7d9f-f19e-29c3-1ea2-861f8753b81a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9824:147F26:1A956B8:246D43F:6A4C09CE
html-safe-nonce66f38f9a3da6c385d0b747f4fea6683826f18a099592d7c7290772f70ce9252d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODI0OjE0N0YyNjoxQTk1NkI4OjI0NkQ0M0Y6NkE0QzA5Q0UiLCJ2aXNpdG9yX2lkIjoiNzM2ODA2MjY3NjM0Mzk4MjU0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac411363eefeabdbef20706ea5b3d37a0f50b7ba70e000d1df0d6c8c6f688034f2
hovercard-subject-tagissue:2442443338
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/BitBLAS/118/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f8aeab0d9bd4d98f9c2e3e64761efb470728282c05dec3a70b24397c2bd8ddca/microsoft/BitBLAS/issues/118
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f8aeab0d9bd4d98f9c2e3e64761efb470728282c05dec3a70b24397c2bd8ddca/microsoft/BitBLAS/issues/118
og:image:altHello, I measured the time of your BitLinear and BitLinearBitBLAS against nn.Linear, and it seems that the time for smaller input_features and out_features is slower than nn.Linear. Is there a solu...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameZiqingChang
hostnamegithub.com
expected-hostnamegithub.com
None940b0dbb4d0fe72558ee760b2ff0f25a504383fdfe404f3a7691ec853b8dc17f
turbo-cache-controlno-preview
go-importgithub.com/microsoft/BitBLAS git https://github.com/microsoft/BitBLAS.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id762181983
octolytics-dimension-repository_nwomicrosoft/BitBLAS
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id762181983
octolytics-dimension-repository_network_root_nwomicrosoft/BitBLAS
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseb0267d17ea43e55446153a7e2c60bb6ac3cffd6b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/BitBLAS/issues/118#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FBitBLAS%2Fissues%2F118
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FBitBLAS%2Fissues%2F118
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FBitBLAS
Reloadhttps://github.com/microsoft/BitBLAS/issues/118
Reloadhttps://github.com/microsoft/BitBLAS/issues/118
Reloadhttps://github.com/microsoft/BitBLAS/issues/118
Please reload this pagehttps://github.com/microsoft/BitBLAS/issues/118
microsoft https://github.com/microsoft
BitBLAShttps://github.com/microsoft/BitBLAS
Notifications https://github.com/login?return_to=%2Fmicrosoft%2FBitBLAS
Fork 59 https://github.com/login?return_to=%2Fmicrosoft%2FBitBLAS
Star 769 https://github.com/login?return_to=%2Fmicrosoft%2FBitBLAS
Code https://github.com/microsoft/BitBLAS
Issues 33 https://github.com/microsoft/BitBLAS/issues
Pull requests 6 https://github.com/microsoft/BitBLAS/pulls
Discussions https://github.com/microsoft/BitBLAS/discussions
Actions https://github.com/microsoft/BitBLAS/actions
Projects https://github.com/microsoft/BitBLAS/projects
Models https://github.com/microsoft/BitBLAS/models
Security and quality 0 https://github.com/microsoft/BitBLAS/security
Insights https://github.com/microsoft/BitBLAS/pulse
Code https://github.com/microsoft/BitBLAS
Issues https://github.com/microsoft/BitBLAS/issues
Pull requests https://github.com/microsoft/BitBLAS/pulls
Discussions https://github.com/microsoft/BitBLAS/discussions
Actions https://github.com/microsoft/BitBLAS/actions
Projects https://github.com/microsoft/BitBLAS/projects
Models https://github.com/microsoft/BitBLAS/models
Security and quality https://github.com/microsoft/BitBLAS/security
Insights https://github.com/microsoft/BitBLAS/pulse
Speed Comparison: BitLinear and nn.Linearhttps://github.com/microsoft/BitBLAS/issues/118#top
https://github.com/ZiqingChang
ZiqingChanghttps://github.com/ZiqingChang
on Aug 1, 2024https://github.com/microsoft/BitBLAS/issues/118#issue-2442443338
https://github.com/microsoft/BitBLAS/blob/main/integration/BitNet/utils_quant.pyhttps://github.com/microsoft/BitBLAS/blob/main/integration/BitNet/utils_quant.py
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.