[qnnpack] Lock before weightpacking in qlinear (#68012)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/68012
Previous attempt to make qlinear threadsafe placed lock after weight ptr was already accessed via packB. Race condition occurs when thread1 acquires lock, packs weights but thread2 still uses old nullptr after acquiring the lock. This causes a null pointer dereference later.
ghstack-source-id: 142714894
Test Plan: Tested on repro diff
Reviewed By: kimishpatel
Differential Revision: D32252563
fbshipit-source-id: 429fcd3f76193f1c4c8081608b6f725b19562230